From: bjori
Operating system: Linux
PHP version: 5.3SVN-2010-12-29 (SVN)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:highlight_string() has leaks
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 bug report at http://bugs.php.net/bug.php?id=53629&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53629&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53629&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53629&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53629&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53629&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53629&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53629&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53629&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53629&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53629&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53629&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53629&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53629&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53629&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53629&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53629&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53629&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53629&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53629&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53629&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53629&r=mysqlcfg