php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51905 ReflectionParameter fails if default value is an array with an access to self::
Submitted: 2010-05-25 13:23 UTC Modified: 2010-05-26 02:01 UTC
From: soid dot exe at hotmail dot com Assigned: felipe (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.13, 5.3.x OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: soid dot exe at hotmail dot com
New email:
PHP Version: OS:

 

 [2010-05-25 13:23 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-26 02:01 UTC] felipe@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-26 02:01 UTC] felipe@php.net
-Status: Open +Status: Closed -PHP Version: 5.2.13 +PHP Version: 5.2.13, 5.3.x -Assigned To: +Assigned To: felipe
 [2010-05-26 02:01 UTC] felipe@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/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC