#47981 [NEW]: error handler not called regardless
| From: | oliver dot graetz at gmx dot de | Date: | Thu, 16 Apr 2009 08:39:13 +0000 |
| Subject: | #47981 [NEW]: error handler not called regardless | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-2102@lists.php.net to get a copy of this message | ||
From: oliver dot graetz at gmx dot de
Operating system: Windows Vista x64 SP1
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: error handler not called regardless
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
--
Edit bug report at http://bugs.php.net/?id=47981&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47981&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47981&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47981&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47981&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47981&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47981&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47981&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47981&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47981&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47981&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47981&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47981&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47981&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47981&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47981&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47981&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47981&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47981&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47981&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47981&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47981&r=mysqlcfg