|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-16 13:56 UTC] bjori@php.net
[2009-04-16 15:55 UTC] oliver dot graetz at gmx dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Jan 07 16:00:02 2026 UTC |
Description: ------------ In the documentation of the set_error_handler it says: 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 This is wrong! Errors of type E_STRICT will only trigger the custom error handler function if error_reporting explicitly includes them. This clearly means that error_reporting() settings HAVE an effect. Personally, I think this is an error in PHP and that the behaviour of PHP should be changed to fit the description in the documentation but from the current point this is at least a documentation problem. Reproduce code: --------------- // --- file 'errorhandler.php' -------------------------------- <?php $errormap = array( E_WARNING=>'E_WARNING', E_NOTICE=>'E_NOTICE', E_STRICT=>'E_STRICT' ); function handleError($errno,$errstr,$errfile,$errline,$errcontext) { echo "$errno (".$GLOBALS['errormap'][$errno].": $errstr\n"; } set_error_handler('handleError'); // --- file 'tester.php' -------------------------------------- <?php include 'errorhandler.php'; error_reporting(E_ALL); $x=5/0; //E_WARNING echo $not_set; //E_NOTICE //E_STRICT interface a{} class b implements a { function f($a=1) {}} class c extends b {function f() {}} Expected result: ---------------- 2 (E_WARNING: Division by zero 8 (E_NOTICE: Undefined variable: not_set 2048 (E_STRICT: Declaration of c::f() should be compatible with that of b::f() Actual result: -------------- 2 (E_WARNING: Division by zero 8 (E_NOTICE: Undefined variable: not_set