#41072 [NEW]: Make instanceof work without the need of creating the object first

From: Date: Fri, 13 Apr 2007 00:49:11 +0000
Subject: #41072 [NEW]: Make instanceof work without the need of creating the object first
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111435@lists.php.net to get a copy of this message
From: atomo64 at gmail dot com Operating system: Linux 2.6.18 SMP i686 PHP version: 5.2.1 PHP Bug Type: Feature/Change Request Bug description: Make instanceof work without the need of creating the object first Description: ------------ At the moment instanceof requires the first 'parameter' to be an object of the class which is to be compared. It would be useful to be able to check without creating the object. Reproduce code: --------------- <?php class MyClass {} $class = 'MyClass'; var_dump($class instanceof MyClass); var_dump($$class instanceof MyClass); var_dump(MyClass instanceof MyClass); ?> Expected result: ---------------- bool(false) bool(true) bool(true) Actual result: -------------- bool(false) bool(false) bool(false) -- Edit bug report at http://bugs.php.net/?id=41072&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41072&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41072&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41072&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41072&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41072&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41072&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41072&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41072&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41072&r=support Expected behavior: http://bugs.php.net/fix.php?id=41072&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41072&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41072&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41072&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41072&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41072&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41072&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41072&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41072&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41072&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41072&r=mysqlcfg

« previous php.bugs (#111435) next »