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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 04:01:29 2025 UTC