Bug #55000 [NEW]: instanceof should fail compile-time if checking for non existant class
| From: | lenar at city dot ee | Date: | Mon, 06 Jun 2011 14:13:04 +0000 |
| Subject: | Bug #55000 [NEW]: instanceof should fail compile-time if checking for non existant class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-161212@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: 5.3.6
Package: Scripting Engine problem
Bug Type: Bug
Bug description:instanceof should fail compile-time if checking for non existant class
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 bug report at http://bugs.php.net/bug.php?id=55000&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=55000&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=55000&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=55000&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=55000&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=55000&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=55000&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=55000&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=55000&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=55000&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=55000&r=support
Expected behavior: http://bugs.php.net/fix.php?id=55000&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=55000&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=55000&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=55000&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=55000&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=55000&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=55000&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=55000&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=55000&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=55000&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=55000&r=mysqlcfg