From: reeze dot xia at gmail dot com
Operating system:
PHP version: Irrelevant
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionParameter::getDefaultValue() memory leaks with
constant
Description:
------------
ReflectionParameter::getDefaultValue() memory leaks with constant.
Test script:
---------------
<?php
define('TEST_CONST', '10');
class Foo {
public function bar($param = TEST_CONST) {
return $param;
}
}
$refl_method = new ReflectionMethod('Foo::bar');
foreach ($refl_method->getParameters() as $param) {
if ($param->isDefaultValueAvailable()) {
var_dump($param->getDefaultValue());
}
}
?>
Expected result:
----------------
string(2) "10"
Actual result:
--------------
string(2) "10"
[Fri Jun 1 14:09:29 2012] Script: '/Users/reeze/Opensource/php-src-
5.3/leak.php'
/Users/reeze/Opensource/php-src-5.3/ext/reflection/php_reflection.c(2424) :
Freeing 0x10C8A69E8 (11 bytes), script=/Users/reeze/Opensource/php-src-
5.3/leak.php
/Users/reeze/Opensource/php-src-5.3/Zend/zend_variables.c(120) : Actual
location
(location was relayed)
=== Total 1 memory leaks detected ===
--
Edit bug report at https://bugs.php.net/bug.php?id=62202&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62202&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62202&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=62202&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62202&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=62202&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62202&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=62202&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=62202&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=62202&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=62202&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=62202&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=62202&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=62202&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62202&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=62202&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62202&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=62202&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=62202&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=62202&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=62202&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=62202&r=mysqlcfg