#42369 [Opn->Fbk]: Implicit conversion to string leaks memory
| From: | stas@php.net | Date: | Thu, 23 Aug 2007 01:02:58 +0000 |
| Subject: | #42369 [Opn->Fbk]: Implicit conversion to string leaks memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116513@lists.php.net to get a copy of this message | ||
ID: 42369
Updated by: stas@php.net
Reported By: david at acz dot org
-Status: Open
+Status: Feedback
Bug Type: SimpleXML related
Operating System: SuSE Linux
PHP Version: 5.2.3
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
couldn't reproduce on latest 5.2.4 RC
Previous Comments:
------------------------------------------------------------------------
[2007-08-21 23:30:17] david at acz dot org
Description:
------------
Passing a SimpleXML string object to most builtin string functions
causes a memory leak.
Reproduce code:
---------------
#!/usr/local/bin/php -d memory_limit=128M
<?
$xml = '<?xml version="1.0" encoding="utf-8"?>';
$x = simplexml_load_string($xml . "<q><x>foo</x></q>");
echo "explicit conversion\n";
for ($i = 0; $i < 1000000; $i++)
md5(strval($x->x));
echo "no conversion\n";
for ($i = 0; $i < 1000000; $i++)
md5($x->x);
echo "done\n";
?>
Expected result:
----------------
$ ./crash.php
explicit conversion
no conversion
done
Actual result:
--------------
$ ./crash.php
explicit conversion
no conversion
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 40 bytes) in /tmp/crash.php on line 12
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42369&edit=1