#26814 [Ver->Csd]: parse error in included file won't stop the main script execution

From: Date: Sun, 25 Jan 2004 23:49:55 +0000
Subject: #26814 [Ver->Csd]: parse error in included file won't stop the main script execution
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-53874@lists.php.net to get a copy of this message
ID: 26814 Updated by: iliaa@php.net Reported By: mccarthy36 at earthlink dot net -Status: Verified +Status: Closed Bug Type: *General Issues Operating System: * PHP Version: 5CVS, 4CVS New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2004-01-06 17:37:19] sniper@php.net one more comment: using require() doesn't matter either, still the main script is run to the end.. ------------------------------------------------------------------------ [2004-01-06 17:35:55] sniper@php.net Parse error -> execution should stop ? (but it doesn't, that's the bug here, IMO) ------------------------------------------------------------------------ [2004-01-06 11:10:02] 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(). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26814&edit=1

« previous php.bugs (#53874) next »