php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28078 include causes script termination on syntax error
Submitted: 2004-04-20 15:53 UTC Modified: 2004-04-20 18:57 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: DavidSmith at byu dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.5 OS: Linux
Private report: No CVE-ID: None
 [2004-04-20 15:53 UTC] DavidSmith at byu dot net
Description:
------------
Under previous versions of PHP, calling include() on a file containing syntax errors did not cause script termination. This is in accordance with the documentation on include(). However, in 4.3.5, syntax errors in included files appear to cause script termination. Tested with 4.1.x, 4.2.x, and 4.3.1.

Reproduce code:
---------------
Two files are required to reproduce this bug:

1. test.php:
<?php
echo "including...<br>\n";
include 'test-error.php';
echo "done.<br>\n";
?>

2. test-error.php (intentionally contains a syntax error):
<?php
*
?>

Expected result:
----------------
It is expected that a syntax error will not cause script termination. Thus, the expected output is this:

including...

Parse error: parse error, unexpected '*' in /var/www/test-error.php on line 3
done.



Actual result:
--------------
including...

Parse error: parse error, unexpected '*' in /var/www/test-error.php on line 3



---
Notice that "done." is not printed, since script execution terminated on the include() line.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-20 18:57 UTC] derick@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Feb 24 12:01:25 2020 UTC