php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38039 ReflectionCLass can't find "self::" constants
Submitted: 2006-07-08 13:53 UTC Modified: 2006-07-08 15:00 UTC
From: baldurien at bbnwn dot eu Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: baldurien at bbnwn dot eu
New email:
PHP Version: OS:

 

 [2006-07-08 13:53 UTC] baldurien at bbnwn dot eu
Description:
------------
Hi,

When I use the "self::" syntax in function parameter - or a in  a constant - the reflection API fails to find the constant.

Note that when using Foo::X, it works.

Reproduce code:
---------------
class Foo {
  const X = 1;
  const Y = self::X;
  
  function f($f = self::X) {}
}
$clazz = new ReflectionClass('Foo');

Expected result:
----------------
No notice

Actual result:
--------------
Notice: Use of undefined constant self::X - assumed 'self::X' in admintools\tests\testmaker.php on line 31

Notice: Use of undefined constant self::X - assumed 'self::X' in admintools\tests\testmaker.php on line 31

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-08 14:03 UTC] baldurien at bbnwn dot eu
Forgot to add that thing : 

echo $clazz;
 [2006-07-08 15:00 UTC] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Read the notice!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC