php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62202 ReflectionParameter::getDefaultValue() memory leaks with constant
Submitted: 2012-06-01 06:13 UTC Modified: 2012-06-01 07:18 UTC
From: reeze dot xia at gmail dot com Assigned: laruence (profile)
Status: Closed Package: Reflection related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: reeze dot xia at gmail dot com
New email:
PHP Version: OS:

 

 [2012-06-01 06:13 UTC] 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 ===

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-01 06:21 UTC] reeze dot xia at gmail dot com
Hi,
   I sent a PR here https://github.com/php/php-src/pull/97

Thanks:)
 [2012-06-01 06:57 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1f5327a6022fedc1985d2daa6d189313d808b08b
Log: Fixed Bug #62202 (ReflectionParameter::getDefaultValue() memory leaks with constant)
 [2012-06-01 07:00 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1f5327a6022fedc1985d2daa6d189313d808b08b
Log: Fixed Bug #62202 (ReflectionParameter::getDefaultValue() memory leaks with constant)
 [2012-06-01 07:01 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1f5327a6022fedc1985d2daa6d189313d808b08b
Log: Fixed Bug #62202 (ReflectionParameter::getDefaultValue() memory leaks with constant)
 [2012-06-01 07:18 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2012-06-01 07:18 UTC] laruence@php.net
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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2014-10-07 23:24 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=1f5327a6022fedc1985d2daa6d189313d808b08b
Log: Fixed Bug #62202 (ReflectionParameter::getDefaultValue() memory leaks with constant)
 [2014-10-07 23:35 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=1f5327a6022fedc1985d2daa6d189313d808b08b
Log: Fixed Bug #62202 (ReflectionParameter::getDefaultValue() memory leaks with constant)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 02 12:01:29 2025 UTC