php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28330 include with parse error kills script
Submitted: 2004-05-09 03:41 UTC Modified: 2004-08-05 23:50 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: microcamers at hotmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5CVS-2004-05-09 (dev) OS: Windows XP
Private report: No CVE-ID: None
 [2004-05-09 03:41 UTC] microcamers at hotmail dot com
Description:
------------
I just upgraded to the latest snapshot and now find that Parse Errors stop the excecution of the script with an error. 
So now i have the choice between displaying no error as to whats happened and a blank page coming up, or displaying an ugly php error telling the user things about my files, because i cannot catch parse errors with php's error handling functions.

Reproduce code:
---------------
if(!@include("file_with_parse_error.php"){
    die("There has been a problem generating this page");
}

Expected result:
----------------
If the file had a parse error or didnt exist, it would die with that error. Or even better i could have it email me.

Actual result:
--------------
Now it just prints "Parse error: parse error, unexpected ..." even though i have put the @ symbol before it. It also gets through output buffering.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-09 09:26 UTC] vkatragadda at email dot com
hello, i think that the fault exists in your script.
if you copied these lines directly, then your missing a right bracket

if(!@include("file_with_parse_error.php"){

should be

if(!@include("file_with_parse_error.php")){

i just spotted this and didn't run the script as i'm having a problem with windoze..

sorry if this is wasting your time :)
 [2004-05-09 13:19 UTC] microcamers at hotmail dot com
Description:
------------
I just upgraded to the latest snapshot and now find that Parse Errors
stop the excecution of the script with an error. 
So now i have the choice between displaying no error as to whats
happened and a blank page coming up, or displaying an ugly php error
telling the user things about my files, because i cannot catch parse
errors with php's error handling functions.

Reproduce code:
---------------
if(!@include("file_with_parse_error.php")){
    die("There has been a problem generating this page");
}

Expected result:
----------------
If the file had a parse error or didnt exist, it would die with that
error. Or even better i could have it email me.

Actual result:
--------------
Now it just prints "Parse error: parse error, unexpected ..." even
though i have put the @ symbol before it. It also gets through output
buffering.
 [2004-05-11 05:43 UTC] vkatragadda at email dot com
hello, i just ran the script and i get this message - 

"There has been a problem generating this page"

so... maybe you should check your ini settings..
 [2004-05-11 09:10 UTC] microcamers at hotmail dot com
If the file doesnt exist, then it will work as expected, but if the file has a parse error then it will halt the script on my PC.
 [2004-08-05 23:50 UTC] edink@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Nov 20 02:00:01 2025 UTC