Edit report at http://bugs.php.net/bug.php?id=51905&edit=1
ID: 51905 Updated by: fel...@php.net Reported by: soid dot exe at hotmail dot com Summary: ReflectionParameter fails if default value is an array with an access to self:: -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Linux -PHP Version: 5.2.13 +PHP Version: 5.2.13, 5.3.x -Assigned To: +Assigned To: felipe New Comment: 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/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2010-05-26 02:01:00] fel...@php.net Automatic comment from SVN on behalf of felipe Revision: http://svn.php.net/viewvc/?view=revision&revision=299766 Log: - Fixed bug #51905 (ReflectionParameter fails if default value is an array with an access to self::) ------------------------------------------------------------------------ [2010-05-25 13:23:51] soid dot exe at hotmail dot com 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 this bug report at http://bugs.php.net/bug.php?id=51905&edit=1