Bug #68164 [Nab]: error_get_last() ignores silence operator
| From: | willem at mollie dot nl | Date: | Tue, 07 Oct 2014 07:47:44 +0000 |
| Subject: | Bug #68164 [Nab]: error_get_last() ignores silence operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187911@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68164&edit=1
ID: 68164
User updated by: willem at mollie dot nl
Reported by: willem at mollie dot nl
Summary: error_get_last() ignores silence operator
Status: Not a bug
Type: Bug
Package: Unknown/Other Function
Operating System: N/A
PHP Version: 5.5.17
Block user comment: N
Private report: N
New Comment:
Thank you. I seems as though I was mistaken with the return value of error_reporting() when using a
custom error handler. There does not seem to be any possibility of checking if the silence operator
was used when using error_get_last() though (e.g. in a shutdown handler).
Previous Comments:
------------------------------------------------------------------------
[2014-10-06 18:55:28] nikic@php.net
That's how it's supposed to work. When suppressing errors you still may want to retrieve
information about it.
------------------------------------------------------------------------
[2014-10-06 13:04:50] willem at mollie dot nl
Description:
------------
The function error_get_last() ignores the silence operator. Functions such as set_error_handler()
received 0 as the value for the error type when the silence operator is used on the expression that
triggered the error. However, error_get_last() does not.
This is rather inconsistent and makes it impossible to ignore errors when using error_get_last() for
error handling (e.g. in a registered shutdown function).
Test script:
---------------
php -r '@1/0; print_r(error_get_last());'
Expected result:
----------------
PHP Warning: Division by zero in Command line code on line 1
Array
(
[type] => 0
[message] => Division by zero
[file] => Command line code
[line] => 1
)
Actual result:
--------------
PHP Warning: Division by zero in Command line code on line 1
Array
(
[type] => 2
[message] => Division by zero
[file] => Command line code
[line] => 1
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68164&edit=1