Re: Question: Should exit() print out the integer exit-status?
| From: | Yasuo Ohgaki | Date: | Wed, 19 Dec 2001 00:43:21 +0000 |
| Subject: | Re: Question: Should exit() print out the integer exit-status? | ||
| References: | 1 2 | Groups: | php.dev php.general |
| Request: | Send a blank email to php-dev+get-74325@lists.php.net to get a copy of this message | ||
Jani Taskinen wrote:
background information: http://bugs.php.net/bug.php?edit=1&id=11008 http://bugs.php.net/bug.php?edit=1&id=14574 exit() function is broken. Fixing the broken behaviour is the only real solution, IMO.Since some people prefer to keep current behavior (for a while?) How about just keep current behavior until ZE2? (PHP 5?) ZE2 will break some ZE1 behavior, I suppose. Making exit() to return "return code" is nice and would be OK for ZE2. IMHO. We really need to consider removing/changing legacy feature & behavior at some point... Error Level and Message handling in current source is one other thing I would like to change :) Do you want consistent error levels, error id, localized error messges? I guess lots of you do ;)
One solution: - When passed argument is string: print out this string - When passed argument is integer: Don't print it, use it as exit-status This is what is the expected behaviour is and I really can't think of any good examples where this would fail. Nobody ever gave any. And to get the REAL users (not only Zeev's opinion) I'm sending this also to php-general. From manual: "The exit() function terminates execution of the script. It prints status just before exiting. If status is an integer, that value will be used as exit-status." This can be understood in many ways. If the status is integer, it is used as exit-status..but it's not clear that it's ALSO printed out which is simply buggy behaviour.
Now, if general concencus amongs the users of PHP is that it should also print out the exit-status when it's an integer then 'shell_exit()' function should be added. --JaniI agree. It's possilbe do this now, w/o much BC problem. die()/exit() is identical in ZE1. How about make them separate? If type is integer, die() for print and return exit code and exit() for only return "return code". -- Yasuo Ohgaki