Edit report at https://bugs.php.net/bug.php?id=62202&edit=1

 ID:                 62202
 Comment by:         reeze dot xia at gmail dot com
 Reported by:        reeze dot xia at gmail dot com
 Summary:            ReflectionParameter::getDefaultValue() memory leaks
                     with constant
 Status:             Open
 Type:               Bug
 Package:            Reflection related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Hi,
   I sent a PR here https://github.com/php/php-src/pull/97

Thanks:)


Previous Comments:
------------------------------------------------------------------------
[2012-06-01 06:13:43] reeze dot xia at gmail dot com

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 this bug report at https://bugs.php.net/bug.php?id=62202&edit=1

Reply via email to