Re: error_handler

From: Date: Fri, 19 Dec 2003 19:49:10 +0000
Subject: Re: error_handler
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-6625@lists.php.net to get a copy of this message
Daniel Convissor wrote:
Just supply it in both PHP 4 and 5 - extra arguments are ignored anyway
Nope... CODE ---- echo phpversion(); set_error_handler('error_handler', 0); function error_handler($code, $text) { echo "<br />Handled... $text"; } $x; OUTPUT ------ 4.3.4 Warning: Wrong parameter count for set_error_handler() in y on line 4 Notice: Undefined variable: x in y on line 8
(just provide @ to make sure of that).
Nope... Sure, adding a @ to the set_error_handler() call supresses the parameter count warning. But, since set_error_handler() failed, the error handler doesn't get called... OUTPUT ------ 4.3.4 Notice: Undefined variable: x in y on line 8 We are not supposed to change 4.3.x right?
So the code with @ is "working". The set_error_handler() is bailing out and everything is ok (as it has been till now). But this statement will work (if the decision is to add additional optional param) on PHP5 which is the aim. So an optional parameter and a @ in the front should help (no matter that @ is ugly). I think this is the idea of Zeev.
--Dan Andrey


« previous php.internals (#6625) next »