Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 84828 - exit() does not report correct exit code
exit() does not report correct exit code
Product: Red Hat Linux
Classification: Retired
Component: php (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Joe Orton
David Lawrence
: 97490 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2003-02-21 14:27 EST by Fred Wittekind
Modified: 2007-04-18 12:51 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-07-03 07:46:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2003:204 normal SHIPPED_LIVE : Updated PHP packages are now available 2003-07-02 00:00:00 EDT

  None (edit)
Description Fred Wittekind 2003-02-21 14:27:07 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)

Description of problem:
Call to exit() returns 255 instead of passed value

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Create test script (test.php)
2. # php -f test.php ; echo $?


Actual Results:  255

Expected Results:  1

Additional info:

Problem is fixed in php 4.2.3 stock source code.
Seems to be fixed by the following patch
(this patch is taken from a diff between 4.2.2 and 4.2.3)
--- php-4.2.2/sapi/cgi/cgi_main.c.orig  2003-02-21 13:42:28.000000000 -0500
+++ php-4.2.2/sapi/cgi/cgi_main.c       2003-02-21 13:53:20.000000000 -0500
@@ -775,11 +775,8 @@
                switch (behavior) {
                        case PHP_MODE_STANDARD:
-                               if (php_execute_script(&file_handle TSRMLS_CC)) 
-                                       exit_status = EG(exit_status);
-                               } else {
-                                       exit_status = 255;
-                               }
+                php_execute_script(&file_handle TSRMLS_CC);
+                exit_status = EG(exit_status);
                        case PHP_MODE_LINT:
                                PG(during_request_startup) = 0;
Comment 1 Joe Orton 2003-06-16 15:51:11 EDT
*** Bug 97490 has been marked as a duplicate of this bug. ***
Comment 2 Joe Orton 2003-06-16 15:52:24 EDT
Thanks for the report, and for tracking down the fix.  This change will be
incorporated for a forthcoming erratum.
Comment 3 Joe Orton 2003-07-03 07:46:47 EDT
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.