From:             hasin at pageflakes dot com
Operating system: Windows XP
PHP version:      5.2.2
PHP Bug Type:     SPL related
Bug description:  ReflectionParameter isDefaultValueAvailable() is  not working 
as expected

Description:
------------
The isDefaultValueAvailable() of ReflectionParameter object doesn't return
true for any parameter if the next parameter in collection has no default
value. To regenerate the bug, execute the following script



Reproduce code:
---------------
<?
class TestClass
{
        public function __construct($a , $b=6 , $c = "hh", $d, $e=76)
        {

        }
}

$class = new ReflectionClass("TestClass");
$method= $class->getMethod("__construct");
$parameter = $method->getParameters();

foreach ($parameter as $param)
{
        if ($param->isDefaultValueAvailable())
        {
                if (is_null($param->getDefaultValue()))
                echo $param->getName()." : null \n";
                else
                echo $param->getName()." : ".$param->getDefaultValue()."\n";
        }
}
?>




Expected result:
----------------
b : 6
c : hh
e : 76

Actual result:
--------------
e : 76

-- 
Edit bug report at http://bugs.php.net/?id=41382&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41382&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41382&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41382&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41382&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41382&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41382&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41382&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41382&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41382&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41382&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41382&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41382&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41382&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41382&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41382&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41382&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41382&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41382&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41382&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41382&r=mysqlcfg

Reply via email to