note 119652 added to language.errors.php7
| From: | demis dot palma at tiscali dot it | Date: | Tue, 26 Jul 2016 11:04:30 +0000 |
| Subject: | note 119652 added to language.errors.php7 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206105@lists.php.net to get a copy of this message | ||
Throwable does not work on PHP 5.x.
To catch both exceptions and errors in PHP 5.x and 7, add a catch block for Exception AFTER catching
Throwable first.
Once PHP 5.x support is no longer needed, the block catching Exception can be removed.
try
{
// Code that may throw an Exception or Error.
}
catch (Throwable $t)
{
// Executed only in PHP 7, will not match in PHP 5
}
catch (Exception $e)
{
// Executed only in PHP 5, will not be reached in PHP 7
}
----
Server IP: 72.52.91.14
Probable Submitter: 188.86.118.156
----
Manual Page -- http://php.net/manual/en/language.errors.php7.php
Edit -- https://master.php.net/note/edit/119652
Del: integrated -- https://master.php.net/note/delete/119652/integrated
Del: useless -- https://master.php.net/note/delete/119652/useless
Del: bad code -- https://master.php.net/note/delete/119652/bad+code
Del: spam -- https://master.php.net/note/delete/119652/spam
Del: non-english -- https://master.php.net/note/delete/119652/non-english
Del: in docs -- https://master.php.net/note/delete/119652/in+docs
Del: other reasons-- https://master.php.net/note/delete/119652
Reject -- https://master.php.net/note/reject/119652
Search -- https://master.php.net/manage/user-notes.php