|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-29 16:12 UTC] sniper@php.net
[2006-01-30 15:16 UTC] volker at puttrich dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 12:00:02 2025 UTC |
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