Bug #69678 [NEW]: Exception handling consistency with namespace
| From: | pahanmipt at mail dot ru | Date: | Thu, 21 May 2015 07:14:42 +0000 |
| Subject: | Bug #69678 [NEW]: Exception handling consistency with namespace | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-192798@lists.php.net to get a copy of this message | ||
From: pahanmipt at mail dot ru
Operating system: Ubuntu 14.04
PHP version: 5.6.9
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Exception handling consistency with namespace
Description:
------------
The exception from global namespace is not catched at namespaced class
methods if exception name is not fully qualified at catch block and no
error occured.
Test script:
---------------
https://github.com/0x-ff/php-gotchas/blob/master/intersting_exception_handling.php
Expected result:
----------------
I think that it would be a fatal error to consistent behaviour with
fatal at
throw new GlobalException(); // not fully qualified => not found
catch(GlobalException $e) { // not fully qualified => MUST BE FATAL not
found
Actual result:
--------------
The exception class GlobalException at test script catches at class only
if
fully qualified
namespace ...;
try {
throw new \GlobalException("");
} catch (GlobalException $e) { // Not catched here and no error occured
that its not fully qualified, just silently ignored that exception
}
--
Edit bug report at https://bugs.php.net/bug.php?id=69678&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69678&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69678&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69678&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69678&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69678&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69678&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69678&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69678&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69678&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69678&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69678&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69678&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69678&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69678&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69678&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69678&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69678&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69678&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69678&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69678&r=mysqlcfg