Re: require_once and E_WARNING?

From: Date: Thu, 06 Jul 2006 04:53:31 +0000
Subject: Re: require_once and E_WARNING?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-239157@lists.php.net to get a copy of this message
>> Code: >> function default_error_handler($code, $error, $file, $line) { >> switch ($code) { >> case E_ERROR: >> die ("Error: $error"); >> case E_WARNING: >> die("Warning: $error"); >> default: >> die("Something else entirely: $error"); >> } >> } >> set_error_handler('default_error_handler'); >> require('This file does not exist. At least not here!'); >> >> Result: >> Warning: require(This file does not exist. At least not here!) >> [function.require]: failed to open stream: No such file or directory >> >> Expected Result: >> Error: require(This file does not exist. At least not here!) >> [function.require]: failed to open stream: No such file or directory >> > > If you comment out the 'set_error_handler' line what happens? Do you get > what you expect (and what should happen) ? > > It looks like a pretty simple bug report to me but others may have > reasons why it's not working. Without the error handler, I get the expected result: A fatal error with the script dying. That is what makes this so mysterious. Doesn't make sense that it would raise a different kind of error under different circumstances. It should have the same value every time. I'm going to sit on this for a day or so and see what people say before I toss it over to the bug folks. No sense in bothering them if I'm being a bonehead. (o;

« previous php.general (#239157) next »