Bug #62715 [Com]: ReflectionParameter::isDefaultValueAvailable() wrong result

From: Date: Thu, 02 Aug 2012 22:53:09 +0000
Subject: Bug #62715 [Com]: ReflectionParameter::isDefaultValueAvailable() wrong result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-172397@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62715&edit=1 ID: 62715 Comment by: benjamin dot morel at strictcoding dot co dot uk Reported by: benjamin dot morel at strictcoding dot co dot uk Summary: ReflectionParameter::isDefaultValueAvailable() wrong result Status: Closed Type: Bug Package: Reflection related Operating System: CentOS 6.3, Windows 7 PHP Version: 5.4.5 Assigned To: laruence Block user comment: N Private report: N New Comment: I can now confirm this works as expected. Thanks for your time! Previous Comments: ------------------------------------------------------------------------ [2012-08-02 14:26:09] laruence@php.net Hi, fixed :) ------------------------------------------------------------------------ [2012-08-02 10:19:20] benjamin dot morel at strictcoding dot co dot uk Thanks for the quick fix, isDefaultValueAvailable() works indeed, but getDefaultValue() still throws an exception: <?php function test(PDO $a = null, $b = 0, array $c) {} $r = new ReflectionFunction('test'); foreach ($r->getParameters() as $p) { if ($p->isDefaultValueAvailable()) { var_export($p->getDefaultValue()); } } Fatal error: Uncaught exception 'ReflectionException' with message 'Parameter is not optional' ------------------------------------------------------------------------ [2012-08-01 12:24:24] 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. ------------------------------------------------------------------------ [2012-08-01 12:23:51] laruence@php.net Automatic comment on behalf of laruence Revision: http://git.php.net/?p=php-src.git;a=commit;h=10642aa9e4f1eb694a8f7b514cc234cb24545744 Log: Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result) ------------------------------------------------------------------------ [2012-08-01 12:22:46] laruence@php.net Automatic comment on behalf of laruence Revision: http://git.php.net/?p=php-src.git;a=commit;h=10642aa9e4f1eb694a8f7b514cc234cb24545744 Log: Fixed bug #62715 (ReflectionParameter::isDefaultValueAvailable() wrong result) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=62715 -- Edit this bug report at https://bugs.php.net/bug.php?id=62715&edit=1

« previous php.bugs (#172397) next »