#21871 [Ver->Bgs]: class_exists() doesn't work for nested classes
| From: | helly@php.net | Date: | Sat, 19 Apr 2003 21:14:32 +0000 |
| Subject: | #21871 [Ver->Bgs]: class_exists() doesn't work for nested classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-37911@lists.php.net to get a copy of this message | ||
ID: 21871
Updated by: helly@php.net
Reported By: yoglets at hotmail dot com
-Status: Verified
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: RedHat 7.3
PHP Version: 5CVS-2003-01-24 (dev)
New Comment:
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
No more support for nested classes.
Previous Comments:
------------------------------------------------------------------------
[2003-04-19 12:02:51] thekid at thekid dot de
As nested class no longer exist, I assume this can be closed.
------------------------------------------------------------------------
[2003-01-24 19:34:19] yoglets at hotmail dot com
Given an instance of a nested class, get_class() returns the "::
separated" name for it, as expected. However, passing that value right
back to class_exists() always fails -- i.e., returns FALSE.
<?php
class Foo {
class Bar {
}
}
$x = new Foo::Bar;
if (class_exists(get_class($x))) {
echo "x is looking good\n";
} else {
echo "x is apparently not itself\n";
}
?>
In addition, get_declared_classes() will only report on the top-level
classes, leaving out any that are nested. In this example, it would
report "Foo", but not "Foo::Bar".
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21871&edit=1