ID: 36187
User updated by: volker at puttrich dot net
Reported By: volker at puttrich dot net
Status: Bogus
Bug Type: CGI related
Operating System: Debian Sarge
PHP Version: 5.1.2
New Comment:
Thank you for your reply ...
I must admit that your example does work.
And I'm sorry, because even my own example works as one would expect. I
didn't try it myself, because I assumed that it would NOT work.
I'm using pretty much the same code in a larger application where it
definately does NOT work. In that application I'm working a lot with
'exec()' and 'system()' and also using IO redirections. It might have
to do with that, but I have not yet been able to isolate the real cause
from within a smaller context.
So for now I'd say that you can close the issue. As soon as I know
where the problem comes from, and it has to do with PHP, I'd happily
re-open this issue if you don't mind.
Again, I'm really sorry that I wasted your time just because I made big
mistake.
PHP-CLI is somewhat cool and I hope it will replace Perl some day, on
Unix-like OS. Thanks for making it...
- Volker
Previous Comments:
------------------------------------------------------------------------
[2006-01-29 16:12:55] [EMAIL PROTECTED]
Works fine for me:
# php t.php ; echo $?
222
t.php:
<?php exit(222); ?>
------------------------------------------------------------------------
[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