ID: 50904
Updated by: [email protected]
Reported By: mb at qapp dot de
Status: Open
Bug Type: Reflection related
Operating System: Linux
PHP Version: 5.2.12
New Comment:
b is not optional as c isn't.
Previous Comments:
------------------------------------------------------------------------
[2010-02-02 08:44:22] mb at qapp dot de
Description:
------------
The method isOptional() doesn't return the correct boolean-value.
Reproduce code:
---------------
<?php
class Test {
public function test( $a, $b = 1, $c ) {}
}
$reflection = new ReflectionClass( 'Test' );
$fparam = $reflection->getMethod( 'test' )->getParameters();
foreach( $fparam as $k => $v ) {
echo $v->getName() . ' ';
echo ( $v->isOptional() ? 'is optional' : 'is not optional' ) .
"\n";
}
?>
Expected result:
----------------
a is not optional
b is optional
c is not optional
Actual result:
--------------
a is not optional
b is not optional
c is not optional
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50904&edit=1