Edit report at http://bugs.php.net/bug.php?id=55000&edit=1
ID: 55000 Updated by: [email protected] Reported by: lenar at city dot ee Summary: instanceof should fail compile-time if checking for non existant class -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 5.3.6 Block user comment: N Private report: N 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 This is expected behavior. You can do something like <?php namespace A; include_once('partial-namespace-a.php'); var_dump($a instanceof Test); which can evaluate to true or false depending on the included file. Previous Comments: ------------------------------------------------------------------------ [2011-06-06 16:13:04] lenar at city dot ee Description: ------------ If the use clause is missing (class/interface not found in current namespace) trigger some fatal error. This would catch many errors when the use clause is just forgotten by developer. I would understand the current behavior for those cases: 1) $a instanceof $b 2) $a instanceof 'BarClass' (not supported currently afaik) Test script: --------------- <?php namespace Test; // use FooNamespace\BarClass; $a = new \stdClass(); var_dump($a instanceof BarClass); Expected result: ---------------- Fatal error or at least some Exception. Actual result: -------------- bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=55000&edit=1
