#21871 [NEW]: class_exists() doesn't work for nested classes
| From: | yoglets at hotmail dot com | Date: | Sat, 25 Jan 2003 01:34:19 +0000 |
| Subject: | #21871 [NEW]: class_exists() doesn't work for nested classes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-31197@lists.php.net to get a copy of this message | ||
From: yoglets@hotmail.com
Operating system: RedHat 7.3
PHP version: 5CVS-2003-01-24 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: class_exists() doesn't work for nested classes
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 bug report at http://bugs.php.net/?id=21871&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21871&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21871&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21871&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21871&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21871&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21871&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21871&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21871&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21871&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21871&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21871&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21871&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21871&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21871&r=gnused