|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81425 exit being ignored in loops
Submitted: 2021-09-08 12:56 UTC Modified: 2021-09-08 14:05 UTC
From: Kai dot Habel at duofaktur dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 8.0.10 OS: Centos 8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
49 - 37 = ?
Subscribe to this entry?

 [2021-09-08 12:56 UTC] Kai dot Habel at duofaktur dot de
Prior to php 8.0 calls to exit or die worked within loops like foreach or switch.
Since 8.0 these statements are totally ignored and this is causing hours and hours of work to use a goto call to end processing in each and every php file.

Test script:
$a = 2;
    case 1:
        echo "1";
    case 2:
        echo "2";
    case 3:
        echo "3";
echo "4";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-08 12:58 UTC]
-Status: Open +Status: Feedback
 [2021-09-08 12:58 UTC]
That's not true, see:
 [2021-09-08 13:07 UTC]
Do you use uopz?
 [2021-09-08 13:10 UTC] Kai dot Habel at duofaktur dot de
-Status: Feedback +Status: Open
 [2021-09-08 13:10 UTC] Kai dot Habel at duofaktur dot de
We do in fact have this issue and are working around this for 3 days now with multiple developers. OS : Centos 7, Remi-Safe Repo and Centos 7/8 Plesk Repo. All systems are running in this issue.
 [2021-09-08 13:24 UTC] Kai dot Habel at duofaktur dot de
No, we are not using uopz
 [2021-09-08 13:41 UTC]
-Status: Open +Status: Feedback
 [2021-09-08 13:41 UTC]
so what extensions do you use? I find it highly unlikely your Test script outputs `14` as reported (esp since $a=2). Can you try running with `php -n` to ensure you disable any extensions?
 [2021-09-08 13:53 UTC] Kai dot Habel at duofaktur dot de
-Status: Feedback +Status: Closed
 [2021-09-08 13:53 UTC] Kai dot Habel at duofaktur dot de
Problem solved. For whatever reason uopz was installed. Removed it and problem was gone. Thanks a lot.
 [2021-09-08 14:05 UTC]
-Status: Closed +Status: Not a bug
 [2021-09-08 14:05 UTC]
If you need uopz for your test suite, I suggest to set
uopz.exit=1[1], and to call uopz_allow_exit(false) in the test
suite's bootstrap.

[1] <>
 [2021-09-10 15:50 UTC] php at example dot org
WTH is that crazy extension which disables exit by default? oO
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jul 01 20:05:46 2022 UTC