php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26814 parse error in included file won't stop the main script execution
Submitted: 2004-01-06 11:10 UTC Modified: 2004-01-25 18:49 UTC
From: mccarthy36 at earthlink dot net Assigned:
Status: Closed Package: *General Issues
PHP Version: 5CVS, 4CVS OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mccarthy36 at earthlink dot net
New email:
PHP Version: OS:

 

 [2004-01-06 11:10 UTC] mccarthy36 at earthlink dot net
Description:
------------
I don't know if this is considered a bug, but in my opinion it's undesirable behavior.  I'm finding that if I try to include a file that has a parse error, the file is not included -- the include function used returns false -- but the "included" file name is in the array returned by get_included_files().

Reproduce code:
---------------
(file 1)
<?php

$worked = "NO";

echo "*", include_once( 'included.php' ), "*";

echo "<pre>"; var_dump( get_included_files() ); echo "</pre>";

echo "#{$worked}#";

?>

(file 2)
<?php

$worked = "YES";

$name = "blah "whatever";

?>

Expected result:
----------------
Since there is a parse error in the "included" file, and include_once() returns false, I expect the name of the "included" file not to appear in the array returned by get_included_files().

Actual result:
--------------
include_once() returns false, yet the name of the "included" file is in the array returned by get_included_files().

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-06 17:35 UTC] sniper@php.net
Parse error -> execution should stop ?
(but it doesn't, that's the bug here, IMO)

 [2004-01-06 17:37 UTC] sniper@php.net
one more comment: using require() doesn't matter either, still the main script is run to the end..

 [2004-01-25 18:49 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2004-03-29 18:30 UTC] magnus at monkerud dot com
actually the way i see it, the main/parent code should continue, it should just not run the wrongly parsed child include() / include_once(), if the main quits just due to a simple parse error then the whole point of differenciating between fatal errors and parse errors goes away.

+ that it makes plugin making very hard in CLI / RUNTIME CONSOLE enviroments, when working on a plugin on a maincode in runtime, and you do a simple parse error in the plugin, then save, then the whole runtime goes down and quit, which makes plugin making a slow nightmare.

Magnus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC