#28464 [Opn->Csd]: catch() does not catch exceptions by interfaces
| From: | helly@php.net | Date: | Fri, 16 Jul 2004 06:40:19 +0000 |
| Subject: | #28464 [Opn->Csd]: catch() does not catch exceptions by interfaces | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62440@lists.php.net to get a copy of this message | ||
ID: 28464
Updated by: helly@php.net
Reported By: d at koteroff dot ru
-Status: Open
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: *
-PHP Version: 5CVS-2004-05-21 (dev)
+PHP Version: 5.0.0
-Assigned To:
+Assigned To: helly
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-06-22 01:55:39] php at koteroff dot ru
Still waiting. :-)
Thanks for RC3.
------------------------------------------------------------------------
[2004-05-21 02:03:15] d at koteroff dot ru
Description:
------------
Seems PHP does not support exception catching by parent interface (not
by parent classes). Why? This is a very powerful method to classify
exceptions in programs.
Documentation says that while comparing type in catch block
'instanceof' operator is used, but following test shows that it is
wrong.
I found corresponding code in the source, zend_execute.c:2866, and it
searches for parent classes only. Why not use instanceof_function?
Do you have any perspectives about this problem? Can I wrote in my book
that PHP will support "interface catching" in the future?
Reproduce code:
---------------
<?
interface E {}
class A extends Exception implements E {}
try {
throw new A();
} catch (E $e) {
echo $e;
}
?>
Expected result:
----------------
prints exception data
Actual result:
--------------
Fatal error: Uncaught exception
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28464&edit=1