php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alon dot wrk at gmail dot com
New email:
PHP Version: OS:

 

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

<?php
$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
<?php
function _do_something(){}
set_error_handler('_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(){}
set_error_handler('_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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-01 16:35 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-12-01 16:35 UTC] requinix@php.net
That code showed NULL in 5.4 too. https://3v4l.org/tcTvu
 [2016-12-01 17:10 UTC] cmb@php.net
Furthermore, error_get_last() returns the expected array, if the error handler returns FALSE. This behavior hasn't changed neither, see <https://3v4l.org/87ovU>.
 [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: Sun Jul 21 07:01:28 2024 UTC