note 104397 deleted from function.set-error-handler by danbrown
| From: | danbrown@php.net | Date: | Mon, 13 Jun 2011 15:50:13 +0000 |
| Subject: | note 104397 deleted from function.set-error-handler by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180487@lists.php.net to get a copy of this message | ||
Note Submitter: francoisrv
----
About what perikilis said, something to note. A shutdown function is executed when PHP closes, not
when an error occurred. If when PHP is done no error has occurred, error_get_last() returns null, so
trying to access it as an array will cause an error, defeating its purpose. A fix will be:
<?php
$error = error_get_last();
if(!is_null($error)){
if ($error['type'] == 1) {
//do your stuff
}
}