From: [EMAIL PROTECTED]
Operating system:
PHP version: 5.3CVS-2008-09-30 (CVS)
PHP Bug Type: Scripting Engine problem
Bug description: Closure - Memory leaks when ReflectionException is thrown
Description:
------------
See below.
Reproduce code:
---------------
<?php
$x = new reflectionmethod('reflectionparameter', 'export');
$y = function() { };
try {
$x->invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1));
} catch (Exception $e) { }
Actual result:
--------------
==5847== 9 bytes in 1 blocks are indirectly lost in loss record 1 of 2
==5847== at 0x4021620: malloc (vg_replace_malloc.c:149)
==5847== by 0x83CEAC1: _emalloc (zend_alloc.c:2285)
==5847== by 0x83CF03E: _estrndup (zend_alloc.c:2440)
==5847== by 0x841DFB7: zend_get_closure_invoke_method
(zend_closures.c:113)
==5847== by 0x818AECF: zim_reflection_parameter___construct
(php_reflection.c:1959)
==5847== by 0x83E7E0C: zend_call_function (zend_execute_API.c:907)
==5847== by 0x8188075: _reflection_export (php_reflection.c:1286)
==5847== by 0x818A78B: zim_reflection_parameter_export
(php_reflection.c:1863)
==5847== by 0x83E7E0C: zend_call_function (zend_execute_API.c:907)
==5847== by 0x818DA96: zim_reflection_method_invokeArgs
(php_reflection.c:2618)
==5847== by 0x8428148: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:315)
==5847== by 0x84291DC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(zend_vm_execute.h:428)
==5847== by 0x842706B: execute (zend_vm_execute.h:104)
==5847== by 0x83F875C: zend_execute_scripts (zend.c:1197)
==5847== by 0x836FBB7: php_execute_script (main.c:2080)
==5847== by 0x8497743: main (php_cli.c:1130)
==5847==
==5847==
==5847== 153 (144 direct, 9 indirect) bytes in 1 blocks are definitely
lost in loss record 2 of 2
==5847== at 0x4021620: malloc (vg_replace_malloc.c:149)
==5847== by 0x83CEAC1: _emalloc (zend_alloc.c:2285)
==5847== by 0x841DF15: zend_get_closure_invoke_method
(zend_closures.c:105)
==5847== by 0x818AECF: zim_reflection_parameter___construct
(php_reflection.c:1959)
==5847== by 0x83E7E0C: zend_call_function (zend_execute_API.c:907)
==5847== by 0x8188075: _reflection_export (php_reflection.c:1286)
==5847== by 0x818A78B: zim_reflection_parameter_export
(php_reflection.c:1863)
==5847== by 0x83E7E0C: zend_call_function (zend_execute_API.c:907)
==5847== by 0x818DA96: zim_reflection_method_invokeArgs
(php_reflection.c:2618)
==5847== by 0x8428148: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:315)
==5847== by 0x84291DC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(zend_vm_execute.h:428)
==5847== by 0x842706B: execute (zend_vm_execute.h:104)
==5847== by 0x83F875C: zend_execute_scripts (zend.c:1197)
==5847== by 0x836FBB7: php_execute_script (main.c:2080)
==5847== by 0x8497743: main (php_cli.c:1130)
--
Edit bug report at http://bugs.php.net/?id=46205&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46205&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46205&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46205&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46205&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46205&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46205&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46205&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46205&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46205&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46205&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46205&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46205&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46205&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46205&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46205&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46205&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46205&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46205&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46205&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46205&r=mysqlcfg