|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73635 error_get_last() returns null after set_error_handler();
Submitted: 2016-12-01 16:29 UTC Modified: 2016-12-11 04:22 UTC
From: alon dot wrk at gmail dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 7.0.13 OS: DEB jessie
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-12-01 16:29 UTC] alon dot wrk at gmail dot com
The next code:

$a["x"];//should trigger notice
var_dump(error_get_last());//return the error array

runs perfectly and returns an error array.
 but when I use set_error_handler it returns null
function _do_something(){}

$a["x"];//should trigger notice
var_dump(error_get_last());//return null

This code works perfectly on PHP5.4 I had changed 3 month ago to PHP7 and since then I am getting nulls in error_get_last() I am using a shutdown function to check if an error has occured and if so to send it to the developer.

The Problem exists in all type of errors notice,warning,error,fatal

Test script:
function _do_something(){}

$a["x"];//should trigger notice
var_dump(error_get_last());//return null

Expected result:
I expect to get an array of the error, like in php 5.*

Actual result:
I am getting null instead of an array


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-01 16:35 UTC]
-Status: Open +Status: Feedback
 [2016-12-01 16:35 UTC]
That code showed NULL in 5.4 too.
 [2016-12-01 17:10 UTC]
Furthermore, error_get_last() returns the expected array, if the error handler returns FALSE. This behavior hasn't changed neither, see <>.
 [2016-12-11 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 00:01:31 2024 UTC