php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81485 exit; does not terminate program
Submitted: 2021-09-28 03:09 UTC Modified: 2021-09-28 13:53 UTC
From: mhkhung at gmail dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 8.0.11 OS: Debian 11
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: mhkhung at gmail dot com
New email:
PHP Version: OS:

 

 [2021-09-28 03:09 UTC] mhkhung at gmail dot com
Description:
------------
This problem only happens on php 8. I tested latest 8.0.11 and 8.0.10 on Debian 11 and checked my sanity with php7.4 which will output the expected results.

exit; appears to exit from current function only. The program will keep going.

Expected result: exit will terminate the script.


Test script:
---------------
<?php

function e() {
    echo "in e\n"; 
    exit;
}

echo "before e\n";
e();
echo "after e\n";

Expected result:
----------------
before e
in e

Actual result:
--------------
before e
in e
after e

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-28 05:38 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2021-09-28 05:38 UTC] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

Works fine here. https://3v4l.org/LFL2m
Maybe you have the same problem as https://bugs.php.net/bug.php?id=81431 ?
 [2021-09-28 10:11 UTC] nikic@php.net
Please check phpinfo or "php -m" for whether you have the uopz extension loaded. It converts exit into a no-op.
 [2021-09-28 13:52 UTC] mhkhung at gmail dot com
Yes it is caused by the uopz package. Please close.
 [2021-09-28 13:53 UTC] mhkhung at gmail dot com
-Status: Feedback +Status: Closed
 [2021-09-28 13:53 UTC] mhkhung at gmail dot com
Caused by the uopz package..
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 15:01:30 2025 UTC