|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-21 09:16 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
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