On Tuesday 24 April 2001 16:48, Boget, Chris wrote:
> > > > standard we are
> > > > if (@foo_bar (42, 4711) == ERROR_CODE) {
> > > >    PrintXMLErrorMessage ();

> Wrong back.  From:
> http://php.net/manual/en/function.set-error-handler.php
>
> ----
> It is important to remember that the standard PHP error handler is
> completely bypassed. error_reporting() settings will have no effect
> and your error handler will be called regardless - however you are
> still able to read the current value of error_reporting() and act
> appropriately. Of particular note is that this value will be 0 if the
> statement that caused the error was prepended by the @ error-control
> operator.
> ----
>
> Using your example, $conn wouldn't be '0' but if any error that is
> generated by mysql_connect, that error code/number (what you are
> going to be looking for) will be '0'.  So if, in the original function
> f00_bar(), it tried to return any error code/number, that code/number
> would be '0' (zero) by nature of having the "@" operator prepended
> to the function call.

Well, we both are right. The snippet I suggested (top of this mail) 
*will* work, because the @ operator doesn't mess with the return value of 
the function. A custom error handling function installed via 
set_error_handler() will *not* work because it won't get the error code.

But I never suggested using set_error_handler() :)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

I sat laughing snidely into my notebook until they showed me a PC running
Linux. And oh! It was as though the heavens opened and God handed down a
client-side OS so beautiful, so graceful, and so elegant that a million
Microsoft developers couldn't have invented it even if they had a hundred
years and a thousand crates of Jolt cola.

- LAN Times

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to