|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-23 01:02 UTC] stas@php.net
[2007-08-23 15:32 UTC] david at acz dot org
[2007-11-05 10:09 UTC] jfdsmit at gmail dot com
[2008-01-31 22:05 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
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