Bug #72445 [Com]: while not considered a part of loop context when breaking from included file.

From: Date: Sat, 18 Jun 2016 13:52:36 +0000
Subject: Bug #72445 [Com]: while not considered a part of loop context when breaking from included file.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201714@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72445&edit=1 ID: 72445 Comment by: maikuolan at gmail dot com Reported by: maikuolan at gmail dot com Summary: while not considered a part of loop context when breaking from included file. Status: Open Type: Bug Package: Unknown/Other Function Operating System: Win7 PHP Version: 7.0.7 Block user comment: N Private report: N New Comment: Notes: - Bug seems to also apply to "foreach" (so, both "foreach" and "while" are affected by this). However, the bug doesn't seem to apply to "for" (we see the expected results when substituting for "for"). - "include", "include_once", "require" and "require_once" all have the same results; Doesn't seem to matter which of these are used. - Bug only applies when the break exists in an included/required file; If the loop and the break exist within the same file, the bug won't apply. Previous Comments: ------------------------------------------------------------------------ [2016-06-18 13:45:36] maikuolan at gmail dot com Description: ------------ "while" not considered a part of the loop context when breaking from an included file. Test script: --------------- <?php /** a.php */ $a = false; while (true) { // Infinite loop if ($a) { break; } include_once 'b.php'; } echo 'This message will never be echoed due to this possible bug.'; <?php /** b.php */ $a = true; continue; Expected result: ---------------- Expected: "This message will never be echoed due to this possible bug.". Actual result: -------------- Actual: "PHP Fatal error: 'continue' not in the 'loop' or 'switch' context in \b.php on line 5". ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72445&edit=1

« previous php.bugs (#201714) next »