php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45236 error_get_last reports errors from other scripts
Submitted: 2008-06-11 13:20 UTC Modified: 2008-07-16 01:00 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: jdp34 at njit dot edu Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.2.6 OS: Linux
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: jdp34 at njit dot edu
New email:
PHP Version: OS:

 

 [2008-06-11 13:20 UTC] jdp34 at njit dot edu
Description:
------------
error_get_last() returns errors from other scripts running on the same PHP instance, or reports errors previously in the script that had since been fixed. If run as the sole contents of a file, it will return the errors that PHP picked up before in previous scripts.

Reproduce code:
---------------
<?php
// the only contents of the file
print_r(error_get_last())
?>

Expected result:
----------------
Nothing.

Actual result:
--------------
Array ( [type] => 8 [message] => Undefined variable: foo [file] => /home/jdp/public_html/not_the_same_script.php [line] => 5 )

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-11 13:23 UTC] jdp34 at njit dot edu
This happens only on my Linux installation, but not on my Windows installation.
 [2008-07-08 13:32 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

IIRC, something like this bug was fixed already..
 [2008-07-16 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2013-10-25 14:44 UTC] r3ntg3n at gmail dot com
Hi all.

I had faced the same problem while I was developing a notification system. My php -v output is:

PHP 5.4.17-pl0-gentoo (cli) (built: Sep 16 2013 18:44:29)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

This bug have been reproduced the next way. I have a php script running in the background as a worker process for Gearman Job Server.

After each job has been finished, script sends a report to an email. If there an error happened during processing any job, error_get_last() will return this error's data into all further reports despite there was an error or not.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 20:01:29 2024 UTC