#36187 [NEW]: PHP-CLI does not return int exit status set by exit()
| From: | volker at puttrich dot net | Date: | Sat, 28 Jan 2006 04:24:47 +0000 |
| Subject: | #36187 [NEW]: PHP-CLI does not return int exit status set by exit() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-92570@lists.php.net to get a copy of this message | ||
From: volker at puttrich dot net
Operating system: Debian Sarge
PHP version: 5.1.2
PHP Bug Type: CGI related
Bug description: PHP-CLI does not return int exit status set by exit()
Description:
------------
The CLI version of PHP does not return the integer exit status to the
shell when using 'exit(integer);' from within the script. PHP will always
return 0 (or 255 probably).
The manual says that it would do.
Calling 'exit("string");' (with a string as parameter) it works as
expected and as mentioned in the manual.
Reproduce code:
---------------
This is what I'm trying to do:
file1.php
---------
<?
system("php ./file2.php", $rv);
fwrite(STDOUT, $rv."\n");
system("php ./file2.php -- -param", $rv);
fwrite(STDOUT, $rv."\n");
?>
file2.php
---------
<?
if($argc < 2)
exit(1);
else
exit(0);
?>
Expected result:
----------------
Execute:
# php ./file1.php
Output should be:
1
0
Actual result:
--------------
Buggy result is:
0
0
--
Edit bug report at http://bugs.php.net/?id=36187&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36187&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36187&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36187&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36187&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36187&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36187&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36187&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36187&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36187&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36187&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36187&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36187&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36187&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36187&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36187&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36187&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36187&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36187&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36187&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36187&r=mysqlcfg