Bug 84828 - exit() does not report correct exit code
Summary: exit() does not report correct exit code
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: php
Version: 8.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Joe Orton
QA Contact: David Lawrence
: 97490 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2003-02-21 19:27 UTC by Fred Wittekind
Modified: 2007-04-18 16:51 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-07-03 11:46:47 UTC

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2003:204 0 normal SHIPPED_LIVE : Updated PHP packages are now available 2003-07-02 04:00:00 UTC

Description Fred Wittekind 2003-02-21 19:27:07 UTC
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 19:51:11 UTC
*** Bug 97490 has been marked as a duplicate of this bug. ***

Comment 2 Joe Orton 2003-06-16 19:52:24 UTC
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 11:46:47 UTC
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.