note 113517 added to function.set-error-handler

From: Date: Wed, 23 Oct 2013 21:34:07 +0000
Subject: note 113517 added to function.set-error-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-197308@lists.php.net to get a copy of this message
If you want to be sure that the native PHP error handler is called without resetting the handler stack (as set_error_handler(null) does), you can simply call set_error_handler with $error_types set to zero. This can be especially use full in conjunction with e.g. error_get_last(): <?php // var_dump or anything else, as this will never be called because of the 0 set_error_handler('var_dump', 0); @$undef_var; restore_error_handler(); // error_get_last() is now in a well known state: // Undefined variable: undef_var ... // Do something $e = error_get_last(); ... ?> ---- Server IP: 195.221.21.36 Probable Submitter: 78.248.208.46 ---- Manual Page -- http://php.net/manual/en/function.set-error-handler.php Edit -- https://master.php.net/note/edit/113517 Del: integrated -- https://master.php.net/note/delete/113517/integrated Del: useless -- https://master.php.net/note/delete/113517/useless Del: bad code -- https://master.php.net/note/delete/113517/bad+code Del: spam -- https://master.php.net/note/delete/113517/spam Del: non-english -- https://master.php.net/note/delete/113517/non-english Del: in docs -- https://master.php.net/note/delete/113517/in+docs Del: other reasons-- https://master.php.net/note/delete/113517 Reject -- https://master.php.net/note/reject/113517 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197308) next »