Edit report at http://bugs.php.net/bug.php?id=51911&edit=1
ID: 51911 Updated by: fel...@php.net Reported by: fel...@php.net Summary: ReflectionParameter::getDefaultValue() memory leaks with constant array -Status: Assigned +Status: Closed Type: Bug Package: Reflection related Operating System: * PHP Version: Irrelevant Assigned To: felipe 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: ------------------------------------------------------------------------ [2010-05-26 00:41:06] fel...@php.net Description: ------------ See below. Test script: --------------- <?php class Foo { const X = 1; public function x($x = array(1)) {} } $clazz = new ReflectionClass('Foo'); $method = $clazz->getMethod('x'); foreach ($method->getParameters() as $param) { if ( $param->isDefaultValueAvailable()) echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), 1), "\n"; } Expected result: ---------------- No memleak. :) Actual result: -------------- $ sapi/cli/php ../bug.php $x : array ( 0 => 1, ) [Tue May 25 19:40:32 2010] Script: '../bug.php' /home/felipe/dev/php5_2/Zend/zend_compile.c(3415) : Freeing 0x08646078 (16 bytes), script=../bug.php [Tue May 25 19:40:32 2010] Script: '../bug.php' /home/felipe/dev/php5_2/ext/reflection/php_reflection.c(2174) : Freeing 0x08648CA4 (44 bytes), script=../bug.php /home/felipe/dev/php5_2/Zend/zend_variables.c(131) : Actual location (location was relayed) [Tue May 25 19:40:32 2010] Script: '../bug.php' /home/felipe/dev/php5_2/Zend/zend_variables.c(132) : Freeing 0x08648D00 (32 bytes), script=../bug.php /home/felipe/dev/php5_2/Zend/zend_alloc.c(2391) : Actual location (location was relayed) [Tue May 25 19:40:32 2010] Script: '../bug.php' /home/felipe/dev/php5_2/Zend/zend_hash.c(788) : Freeing 0x08648D50 (35 bytes), script=../bug.php /home/felipe/dev/php5_2/Zend/zend_hash.c(388) : Actual location (location was relayed) === Total 4 memory leaks detected === ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51911&edit=1