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: Always Steps to Reproduce: 1.Create test script (test.php) <?php exit(1); ?> 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); break; case PHP_MODE_LINT: PG(during_request_startup) = 0;
*** Bug 97490 has been marked as a duplicate of this bug. ***
Thanks for the report, and for tracking down the fix. This change will be incorporated for a forthcoming erratum.
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. http://rhn.redhat.com/errata/RHSA-2003-204.html