Bug #11008 Updated: exit() should return an exit status if passed, not send to stdout

From: Date: Sun, 15 Jul 2001 20:43:20 +0000
Subject: Bug #11008 Updated: exit() should return an exit status if passed, not send to stdout
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-60062@lists.php.net to get a copy of this message
ID: 11008 Updated by: zeev Reported By: brianm@dealnews.com Old Status: Open Status: Closed Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.0 Latest CVS (2001-05-21) New Comment: Simply put - no, it should not. exit's optional argument is a termination message, not a shell status. Previous Comments: ------------------------------------------------------------------------ [2001-05-23 11:24:22] brianlmoon@php.net Anyone in the Zend core want to comment on this? I know where the code is that does it. But it is in the Zend code. Is there a good reason to put this exit status to stdout? ------------------------------------------------------------------------ [2001-05-22 01:59:53] bbonev@php.net indeed it does both: if php; then echo yes; fi <? exit(0) ?> X-Powered-By: PHP/4.0.5 Content-type: text/html 0yes if php; then echo yes; fi <? exit(1) ?> X-Powered-By: PHP/4.0.5 Content-type: text/html 1 i don't see a real reason for the echoed exit status though ------------------------------------------------------------------------ [2001-05-21 21:34:23] brianm@dealnews.com Working with a shell script here. I hoped that exit() would work like perl and return the passed status as and exist status. As it stands now, it sends it to stdout. This is unexpected. It would be much more useful if exit() could be used to enable the use of PHP in shell scripts by returning the passed value as an exit status. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=11008&edit=1

« previous php.dev (#60062) next »