php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25842 Error Reporting not catching parse errors
Submitted: 2003-10-11 23:08 UTC Modified: 2003-10-12 19:57 UTC
From: corrupted_wise at yahoo dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.3.4RC1 OS: Win XP SP1
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: corrupted_wise at yahoo dot com
New email:
PHP Version: OS:

 

 [2003-10-11 23:08 UTC] corrupted_wise at yahoo dot com
Description:
------------
When attempting to catch an error with a set_error_handler function, it always misses a parse error.  For example, when loading a php file, no matter if require, include, require_once..etc. is used, the default php bold errors are displayed when the function is ignored.  Notice errors load fine, tho.

I have not made any changes to php.ini-dist, and no modules.
I'm running this on Apache 2.0.47.

Reproduce code:
---------------
<?php
function error_handler($errno, $errstr, $errfile, $errline, $errctx) {
    echo "\nerror_handler:\n\terrno=$errno\n\terrstr=$errstr\n";
    echo "\terrfile=$errfile\n\terrline=$errline\n";
    die();
}
set_error_handler("error_handler");
error_reporting(E_ALL);

// load file with parse error
include "error.php";
exit;
?>

Expected result:
----------------
error_handler:
 errno=4
 errstr=Parse error: parse error, unexpected ',', expecting ']' in error.php on line 65
 errfile=error.php
 errline=1

Actual result:
--------------
<b>Parse error: parse error, unexpected ',', expecting ']' in error.php on line 65</b>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-12 19:57 UTC] sniper@php.net
RTFM: http://www.php.net/set_error_handler

"Note:  The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR and E_COMPILE_WARNING."

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 06:01:31 2024 UTC