note 82137 added to function.restore-error-handler

From: Date: Fri, 28 Mar 2008 16:14:50 +0000
Subject: note 82137 added to function.restore-error-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-137677@lists.php.net to get a copy of this message
Isole is kind of wrong. The handlers are stacked with set_error_handler, and popped with restore_error_handler(). Here i put an example: <?php mysql_connect("inexistent"); //Generate an error. The actual error handler is set by default function foo1() {echo "<br>Error foo1<br>";} function foo2() {echo "<br>Error foo2<br>";} function foo3() {echo "<br>Error foo3<br>";} set_error_handler("foo1"); //current error handler: foo1 set_error_handler("foo2"); //current error handler: foo2 set_error_handler("foo3"); //current error handler: foo3 mysql_connect("inexistent"); restore_error_handler(); //now, current error handler: foo2 mysql_connect("inexistent"); restore_error_handler(); //now, current error handler: foo1 mysql_connect("inexistent"); restore_error_handler(); //now current error handler: default handler mysql_connect("inexistent"); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 200.87.106.107 ---- Manual Page -- http://www.php.net/manual/en/function.restore-error-handler.php Edit -- https://master.php.net/note/edit/82137 Del: integrated -- https://master.php.net/note/delete/82137/integrated Del: useless -- https://master.php.net/note/delete/82137/useless Del: bad code -- https://master.php.net/note/delete/82137/bad+code Del: spam -- https://master.php.net/note/delete/82137/spam Del: non-english -- https://master.php.net/note/delete/82137/non-english Del: in docs -- https://master.php.net/note/delete/82137/in+docs Del: other reasons-- https://master.php.net/note/delete/82137 Reject -- https://master.php.net/note/reject/82137 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137677) next »