ID: 36187
Updated by: [EMAIL PROTECTED]
Reported By: volker at puttrich dot net
-Status: Open
+Status: Bogus
Bug Type: CGI related
Operating System: Debian Sarge
PHP Version: 5.1.2
New Comment:
Works fine for me:
# php t.php ; echo $?
222
t.php:
<?php exit(222); ?>
Previous Comments:
------------------------------------------------------------------------
[2006-01-28 05:24:46] volker at puttrich dot net
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 this bug report at http://bugs.php.net/?id=36187&edit=1