Zeev,

> New Comment:
>
> Simply put - no, it should not.
>
> exit's optional argument is a termination message, not a shell status.

Actually, if exit's argument is of type long, then the status is set. I think that 
since we support this functionality
echoing the status code doesn't make much sense.

To make matters more confusing, the documentaion incorrectly states that die prints a 
termination message,
and that exit sets a status code. I actually agree with seperating die and exit, but I 
realize this could cause
backwards compatibility issues. So IMHO, I see 2 possible fixes

1. ) Seperate die, exit, and implement them as the php manual states
2. ) Modify the condition of exits param being a long to not print the message


ie
                                        ptr = get_zval_ptr(&opline->op1, Ts, 
&EG(free_op1), BP_VAR_R);
                                        if (Z_TYPE_P(ptr) == IS_LONG) {
                                                EG(exit_status) = Z_LVAL_P(ptr);
                                        } else zend_print_variable(ptr);
                                        FREE_OP(&opline->op1, EG(free_op1));


-Jason



> Previous Comments:
> ------------------------------------------------------------------------
>
> [2001-05-23 11:24:22] [EMAIL PROTECTED]
>
> 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] [EMAIL PROTECTED]
>
> 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] [EMAIL PROTECTED]
>
> 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
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to