Bug #66087 [Opn->Nab]: set_error_handler returns handler that does not match the mask
| From: | requinix@php.net | Date: | Wed, 13 Nov 2013 18:45:05 +0000 |
| Subject: | Bug #66087 [Opn->Nab]: set_error_handler returns handler that does not match the mask | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182743@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66087&edit=1
ID: 66087
Updated by: requinix@php.net
Reported by: ukrtelecom at gmail dot com
Summary: set_error_handler returns handler that does not
match the mask
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Ubuntu 12.04 x64
PHP Version: 5.4Git-2013-11-13 (Git)
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
set_error_handler() only installs one error handler. The mask doesn't mean "install this
handler as the handler for this mask" but rather "install this handler as the one custom
error handler but only call it for this mask".
The other bug is about how previous error handlers are saved in a stack and can be recalled later
but that the error mask is not treated the same way. A different issue; if you
restore_error_handler()d after your code then the first handler (also $cb so you wouldn't
notice the difference) would be restored but the mask would remain unchanged at E_WARNING.
Previous Comments:
------------------------------------------------------------------------
[2013-11-13 10:35:09] ukrtelecom at gmail dot com
Description:
------------
set_error_handler returns the previously defined error handler for any mask.
It must be related to https://bugs.php.net/bug.php?id=63206
Test script:
---------------
<?php
$cb = function ($errno, $errstr, $errfile, $errline, $errcontext){return false;};
var_dump(set_error_handler($cb, E_NOTICE));
var_dump(set_error_handler($cb, E_WARNING));
Expected result:
----------------
NULL
NULL
Actual result:
--------------
NULL
object(Closure)#1 (1) {
["parameter"]=>
array(5) {
["$errno"]=>
string(10) "<required>"
["$errstr"]=>
string(10) "<required>"
["$errfile"]=>
string(10) "<required>"
["$errline"]=>
string(10) "<required>"
["$errcontext"]=>
string(10) "<required>"
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66087&edit=1