note 82139 added to function.restore-error-handler

From: Date: Fri, 28 Mar 2008 16:21:15 +0000
Subject: note 82139 added to function.restore-error-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-137679@lists.php.net to get a copy of this message
Isolde is kind of wrong. The error 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"); restore_error_handler(); //now current error handler: default handler (The stack can't pop more) ?> ---- 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/82139 Del: integrated -- https://master.php.net/note/delete/82139/integrated Del: useless -- https://master.php.net/note/delete/82139/useless Del: bad code -- https://master.php.net/note/delete/82139/bad+code Del: spam -- https://master.php.net/note/delete/82139/spam Del: non-english -- https://master.php.net/note/delete/82139/non-english Del: in docs -- https://master.php.net/note/delete/82139/in+docs Del: other reasons-- https://master.php.net/note/delete/82139 Reject -- https://master.php.net/note/reject/82139 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137679) next »