php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15154 set_error_handler(): some parse errors not caught
Submitted: 2002-01-21 18:52 UTC Modified: 2002-01-22 15:33 UTC
From: J dot Kolakowski at students dot mimuw dot edu dot pl Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0CVS-2002-01-21 OS: PLD Linux 2.4.16
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: J dot Kolakowski at students dot mimuw dot edu dot pl
New email:
PHP Version: OS:

 

 [2002-01-21 18:52 UTC] J dot Kolakowski at students dot mimuw dot edu dot pl
Some parse errors are caught by assigned error handler, and some are not.

I use:

error_reporting(E_ALL);
set_error_handler('my_error_handler');

For example:

<?php
i_am_some_parse_error
?>

is caught by error handler, and:

<?php
i_am_some_parse_error = 1;
?>

is not caught and displays: "Parse error: parse error in ... on line ...".

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-21 22:31 UTC] mfischer@php.net
The first one is a runtime warning (Use of undefined constant ...) and not an parser error.
 [2002-01-22 13:54 UTC] J dot Kolakowski at students dot mimuw dot edu dot pl
If the first one is not an parse error, why do I see "Parse error: parse error in ... on line ..." when I run the code without calling set_error_handler()? Are there any parse errors that are caught by an error handler?

 [2002-01-22 15:33 UTC] mfischer@php.net
It's unclear to me how you can reproduce a parser error:

$ ~/php/4.1.1/bin/php -q
<?
error_reporting(E_ALL);
i_am_some_parse_error
?>
<br>
<b>Warning</b>:  Use of undefined constant i_am_some_parse_error - assumed 'i_am_some_parse_error' in <b>-</b> on line <b>4</b><br>

I tested both 4.1.1 and CVS cgi. Where you using the CLI version?
 [2002-01-22 15:59 UTC] J dot Kolakowski at students dot mimuw dot edu dot pl
And suppose i have the following main.php file:

<?php
function my_handler(...)
{ /* ... */ }
error_reporting(E_ALL);
set_error_handler('my_handler');
include('file_with_errors.php');
?>

and the file_with_errors.php contains some parse errors. Am I right, that there is no way to handle errors from file_with_errors.php?
 [2003-09-14 12:16 UTC] ralph at netzbeben dot de
oh well:

from the php docs: 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: Wed Sep 25 09:01:27 2024 UTC