Bug #51905 [NEW]: ReflectionParameter fails if default value is an array with an access to self::
| From: | soid dot exe at hotmail dot com | Date: | Tue, 25 May 2010 11:23:57 +0000 |
| Subject: | Bug #51905 [NEW]: ReflectionParameter fails if default value is an array with an access to self:: | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-150792@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: 5.2.13
Package: Scripting Engine problem
Bug Type: Bug
Bug description:ReflectionParameter fails if default value is an array with an access to self::
Description:
------------
The problem is similar to http://bugs.php.net/38465 but an
access to self::
is
enclosed within an array (see the test script).
Test script:
---------------
class Foo {
const X = 1;
public function x($x = array(self::X)) {}
}
$clazz = new ReflectionClass('Foo');
$method = $clazz->getMethod('x');
foreach ($method->getParameters() as $param) {
if ( $param->isDefaultValueAvailable())
echo '$', $param->getName(), ' : ', $param->getDefaultValue(),
"\n";
}
Expected result:
----------------
should not fail
Actual result:
--------------
$x :
Fatal error: Cannot access self:: when no class scope is active in
/home/soid/Code/test.php on line 12
--
Edit bug report at http://bugs.php.net/bug.php?id=51905&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51905&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51905&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51905&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51905&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51905&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51905&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51905&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51905&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51905&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51905&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51905&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51905&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51905&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51905&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51905&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51905&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51905&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51905&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51905&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51905&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51905&r=mysqlcfg