ID: 29986
Comment by: ante dot dfg at moj dot net
Reported By: mitchel at sahertian dot com
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: Linux 2.6.8.1 x86
PHP Version: 5.0.1
New Comment:
Interestingly enough this example(btw there's an error at end of DEFINE
- define("FOOBAR",0x0008): <- this should be ;) when copy paste and run
dies with Fatal error: Trying to clone an uncloneable object of class
ReflectionClass in c:\serverroot\test.php on line 11
but If I put a reference in $o=new ReflectionClass("MyClass");
making it $o=&new ReflectionClass("MyClass");
then I actualy get the message ("actual result") that Michael
stated....
I'm using php 5.0.1 (release version) on XP Pro under Apache
1.3.31....
Hope this helps somehow...
Previous Comments:
------------------------------------------------------------------------
[2004-09-05 15:40:22] mitchel at sahertian dot com
Description:
------------
I have a variable classname i have to get a constant/static property
from.
${$classname}::stuff
doesn't work, so i have to use the reflection api.
This works for strings and numbers, but when i try to use getConstant()
upon a constant that is defined as another constant, it returns
UNKNOWN:0.
This happens for user defined constants as well as things like `true'.
Reproduce code:
---------------
<?php
define("FOOBAR",0x0008):
class Myclass {
const foo = true;
const bar = FOOBAR;
const works = "yes it does";
}
$o=new ReflectionClass("MyClass");
var_dump($o->getConstant("foo"));
var_dump($o->getConstant("bar"));
var_dump($o->getConstant("works"));
?>
Expected result:
----------------
bool(true)
int(8)
string(11) "yes it does"
Actual result:
--------------
UNKNOWN:0
UNKNOWN:0
string(11) "yes it does"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29986&edit=1