[Tickets #6660] Re: Fatal error with very big strings conversion
bugs at horde.org
bugs at horde.org
Mon Apr 28 18:08:47 UTC 2008
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/6660
-----------------------------------------------------------------------
Ticket | 6660
Updated By | admin at elektordi.net
Summary | Fatal error with very big strings conversion
Queue | Horde Framework Packages
Version | FRAMEWORK_3
Type | Bug
State | Unconfirmed
Priority | 3. High
Milestone |
Patch | [See the hack in the description.]
Owners |
-----------------------------------------------------------------------
admin at elektordi.net (2008-04-28 14:07) wrote:
Hello,
I got a problem today with a very big text mail (~4Mo) due to an infinite
loop in a log deamon. This causes my whole mailbox page to crash with an
PHP Fatal error:
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried
to allocate 16187725 bytes) in /usr/share/horde3/lib/Horde/String.php on
line 128
I managed to prevent the error with the following hack:
/* HACK by Elektordi 2008-04-28: Prevent crashs caused by very big
text mails */
if(strlen($input)>1048576 && String::extensionExists('mbstring'))
{
return @mb_convert_encoding($input, $to, $from);
}
in file String.php and function _convertCharset, just before the line /*
Use utf8_[en|de]code() if possible. */
I did this because Mbstring seems to allocate much less memory than
utf8_xxcode functions. But a better test in the "if" is to check the free
memory instead of using the constant 1048576 (=1024*1024)
Hope this will help you!
Regards,
Elektordi
More information about the bugs
mailing list