#30504 [Opn->Bgs]: When using a custom error handler, a failed require() produces only E_WARNING
| From: | derick@php.net | Date: | Thu, 21 Oct 2004 07:16:16 +0000 |
| Subject: | #30504 [Opn->Bgs]: When using a custom error handler, a failed require() produces only E_WARNING | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67871@lists.php.net to get a copy of this message | ||
ID: 30504
Updated by: derick@php.net
Reported By: danieltalsky at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Output Control
Operating System: FreeBSD
PHP Version: 5.0.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
Previous Comments:
------------------------------------------------------------------------
[2004-10-21 01:19:06] danieltalsky at gmail dot com
Description:
------------
Unexpected behaviors when using a custom error reporting function.
1. a failed require() reports a E_WARNING (instead of the expected
E_ERROR) and then uses the default PHP fatal error (it appear TWICE)
3. calling a bogus function like foobar() DOES create a fatal error,
but uses the default PHP error output and never reaches my custom
handler
Note: This is a CLI script.
Reproduce code:
---------------
function pv_shell_error_logger(
$errno, $errstr, $errfile, $errline){
switch ($errno){
case E_ERROR:
print ('E_ERROR');
break;
case E_WARNING:
print ('E_WARNING');
break;
}
return true;
}
// set to the user defined error handler
set_error_handler("pv_shell_error_logger",
(E_ERROR|E_WARNING|E_PARSE));
// Test1 prints 'E_WARNING' but also stops code execution
require('this should produce a fatal error');
// Test2 uses PHP's default error handler
foobar('this should use the custom error handler');
Expected result:
----------------
There's two test cases here...
Test1: the require() statement prints out E_WARNING, but stops program
execution
Test2: the foobar() function throws a default PHP fatal error and stops
program execution
Actual result:
--------------
Test1: should print E_ERROR and continue execution unless there is an
exit()/die() in the custom handler
Test2: same
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30504&edit=1