Edit report at http://bugs.php.net/bug.php?id=53629&edit=1
ID: 53629 Updated by: il...@php.net Reported by: bj...@php.net Summary: highlight_string() has leaks -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 5.3SVN-2010-12-29 (SVN) -Assigned To: +Assigned To: iliaa Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2011-01-03 15:39:51] il...@php.net Automatic comment from SVN on behalf of iliaa Revision: http://svn.php.net/viewvc/?view=revision&revision=307028 Log: Fixed Bug #53629 (memory leak inside highlight_string()). ------------------------------------------------------------------------ [2010-12-29 18:10:11] bj...@php.net The following patch has been added/updated: Patch Name: heredoc Revision: 1293642611 URL: http://bugs.php.net/patch-display.php?bug=53629&patch=heredoc&revision=1293642611 ------------------------------------------------------------------------ [2010-12-29 18:02:41] bj...@php.net Description: ------------ memleak Test script: --------------- <?php $str = ' <?php class foo { public $bar = <<<EOT bar EOT; } ?> '; $str2 = ' <?php var_dump(array(<<<EOD foobar! EOD )); ?> '; highlight_string($str, true); highlight_string($str2, true); Actual result: -------------- ==26002== HEAP SUMMARY: ==26002== in use at exit: 2,228 bytes in 2 blocks ==26002== total heap usage: 11,067 allocs, 11,065 frees, 2,819,307 bytes allocated ==26002== ==26002== 4 bytes in 1 blocks are definitely lost in loss record 1 of 2 ==26002== at 0x4C2815C: malloc (vg_replace_malloc.c:236) ==26002== by 0x6D0B67: _emalloc (zend_alloc.c:2401) ==26002== by 0x6D1023: _estrndup (zend_alloc.c:2556) ==26002== by 0x6B8C07: lex_scan (zend_language_scanner.l:2093) ==26002== by 0x6F3146: zend_highlight (zend_highlight.c:96) ==26002== by 0x6B1C87: highlight_string (zend_language_scanner.l:774) ==26002== by 0x5E1C4C: zif_highlight_string (basic_functions.c:5163) ==26002== by 0x7405DF: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:638) ==26002== by 0x746729: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1935) ==26002== by 0x73F0BF: execute (zend_vm_execute.h:410) ==26002== by 0x7039C5: zend_execute_scripts (zend.c:1212) ==26002== by 0x67B45F: php_execute_script (main.c:2337) ==26002== by 0x83E3E9: main (php_cli.c:1254) ==26002== ==26002== 2,224 bytes in 1 blocks are still reachable in loss record 2 of 2 ==26002== at 0x4C2815C: malloc (vg_replace_malloc.c:236) ==26002== by 0x6D11CD: alloc_globals_ctor (zend_alloc.c:2623) ==26002== by 0x6D1248: start_memory_manager (zend_alloc.c:2646) ==26002== by 0x7025CA: zend_startup (zend.c:642) ==26002== by 0x67A75A: php_module_startup (main.c:1889) ==26002== by 0x83CD04: php_cli_startup (php_cli.c:425) ==26002== by 0x83DB13: main (php_cli.c:802) ==26002== ==26002== LEAK SUMMARY: ==26002== definitely lost: 4 bytes in 1 blocks ==26002== indirectly lost: 0 bytes in 0 blocks ==26002== possibly lost: 0 bytes in 0 blocks ==26002== still reachable: 2,224 bytes in 1 blocks ==26002== suppressed: 0 bytes in 0 blocks ==26002== ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53629&edit=1