Bug #17107 Updated: exit() always reports exit status=255

From: Date: Mon, 13 May 2002 18:10:49 +0000
Subject: Bug #17107 Updated: exit() always reports exit status=255
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-7542@lists.php.net to get a copy of this message
ID: 17107 Updated by: phpbug@robin.pfft.net Reported By: phpbug@robin.pfft.net Status: Assigned Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.2.0 Assigned To: derick New Comment: Here's another workaround for you if you have --enable-pcntl: $ php -q <?php pcntl_exec("/bin/sh", array("-c", "exit 123")); ?> $ echo $? 123 Previous Comments: ------------------------------------------------------------------------ [2002-05-13 13:47:19] dave@cc0.net Experiencing same problem on 4.2.0/Linux. Return from global scope does not seem to work for me though or else I would use it as an alternative. Is this fixed in CVS? -Dave ------------------------------------------------------------------------ [2002-05-10 02:06:14] derick@php.net I think I broke this, so I'll fix it too :) Derick ------------------------------------------------------------------------ [2002-05-08 21:44:49] phpbug@robin.pfft.net $ php -v 4.2.0 $ php -q <?php exit(5); ?> $ echo $? 255 exit(n) always reports 255 (or -1) as exit status to the OS, regardless of the value it is passed as argument. The correct behavior according to the documentation would be to report n as exit status, or echo n if n is a string. The only workaround I could find is to use return from the global scope. Thank you :) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17107&edit=1

« previous php.bugs (#7542) next »