Doc #73892 [NEW]: Error handler example is kind of misleading
| From: | andre at webkr dot de | Date: | Mon, 09 Jan 2017 02:05:26 +0000 |
| Subject: | Doc #73892 [NEW]: Error handler example is kind of misleading | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-14315@lists.php.net to get a copy of this message | ||
From: andre at webkr dot de
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Error handler example is kind of misleading
Description:
------------
On manual page http://www.php.net/function.set-error-handler
there is an
example of an error handler and it contains this code:
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting
return;
}
I think this gives the impression that this code emulates the behavior
of the "normal" error handler: If the error is not included in the
current error_reporting, do nothing.
However, there is a difference between this code and the case when no
error handler is set at all. This code breaks error_get_last().
See https://3v4l.org/nvNsr
I suggest this code to be changed into
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting
return false;
}
Because that would emulate the exact same behavior as when no error
handler is set at all:
https://3v4l.org/cp5l0
--
Edit bug report at https://bugs.php.net/bug.php?id=73892&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73892&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73892&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73892&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73892&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73892&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73892&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73892&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73892&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73892&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73892&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73892&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73892&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73892&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73892&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73892&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73892&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73892&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73892&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73892&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73892&r=mysqlcfg