Doc #73892 [Opn->Csd]: Error handler example is kind of misleading
| From: | tpunt@php.net | Date: | Tue, 17 Jan 2017 10:39:55 +0000 |
| Subject: | Doc #73892 [Opn->Csd]: Error handler example is kind of misleading | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14356@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73892&edit=1
ID: 73892
Updated by: tpunt@php.net
Reported by: andre at webkr dot de
Summary: Error handler example is kind of misleading
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Unknown/Other Function
PHP Version: Irrelevant
-Assigned To:
+Assigned To: tpunt
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2017-01-17 10:39:06] tpunt@php.net
Automatic comment from SVN on behalf of tpunt
Revision: http://svn.php.net/viewvc/?view=revision&revision=341674
Log: Resolve doc bug #73892
------------------------------------------------------------------------
[2017-01-09 02:05:25] andre at webkr dot de
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 this bug report at https://bugs.php.net/bug.php?id=73892&edit=1