Bug #68164 [Opn->Nab]: error_get_last() ignores silence operator
| From: | nikic@php.net | Date: | Mon, 06 Oct 2014 18:55:29 +0000 |
| Subject: | Bug #68164 [Opn->Nab]: error_get_last() ignores silence operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187898@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
Updated by: nikic@php.net
Reported by: willem at mollie dot nl
Summary: error_get_last() ignores silence operator
-Status: Open
+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:
That's how it's supposed to work. When suppressing errors you still may want to retrieve
information about it.
Previous Comments:
------------------------------------------------------------------------
[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