Bug #69979 [Opn->Nab]: TypeError does not extend Exception

From: Date: Thu, 02 Jul 2015 04:03:14 +0000
Subject: Bug #69979 [Opn->Nab]: TypeError does not extend Exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194055@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69979&edit=1

 ID:                 69979
 Updated by:         requinix@php.net
 Reported by:        grzegorz129 at gmail dot com
 Summary:            TypeError does not extend Exception
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Linux
 PHP Version:        7.0.0alpha2
 Block user comment: N
 Private report:     N

 New Comment:

Take a look at https://wiki.php.net/rfc/throwable-interface.
Additionally,
- Existing catch(Exception $e) code will continue to not catch errors
- Exception vs Error presents a clear separation between exceptions and errors

To catch everything, simply catch BaseException (alpha1) or Throwable (alpha2).


Previous Comments:
------------------------------------------------------------------------
[2015-07-02 02:57:47] grzegorz129 at gmail dot com

Description:
------------
Since development versions of PHP 7.0 TypeException was thrown, from alpha2 TypeError replaced it.
Unfortunately none of them extends Exception - is there any reason for that?
It could introduce a lot of incompatibility - a lot of code catches some specific exceptions and at
the end catches Exception. Good example of that is phpUnit - under PHP 7.0 is impossible to use
setExpectedException() with TypeError because it doesn't extend Exception.

Test script:
---------------
http://3v4l.org/eMijr



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69979&edit=1


Thread (2 messages)

« previous php.bugs (#194055) next »