From:             felipe
Operating system: *
PHP version:      Irrelevant
Package:          Reflection related
Bug Type:         Bug
Bug description:ReflectionParameter::getDefaultValue() memory leaks with 
constant array

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 bug report at http://bugs.php.net/bug.php?id=51911&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51911&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51911&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51911&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51911&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51911&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51911&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51911&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51911&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51911&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51911&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51911&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51911&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51911&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51911&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51911&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51911&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51911&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51911&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51911&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51911&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51911&r=mysqlcfg

Reply via email to