#23509 [Asn->Csd]: exit retcode ignored when called from a register_shutdown_function
| From: | iliaa@php.net | Date: | Fri, 01 Aug 2003 12:29:53 +0000 |
| Subject: | #23509 [Asn->Csd]: exit retcode ignored when called from a register_shutdown_function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45170@lists.php.net to get a copy of this message | ||
ID: 23509
Updated by: iliaa@php.net
Reported By: ldemailly at qualys dot com
-Status: Assigned
+Status: Closed
Bug Type: CGI related
Operating System: Linux 2.4.20
PHP Version: 4.3.2RC3-dev
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-05-06 11:58:37] ldemailly at qualys dot com
exit retcode ignored when called from a register_shutdown_function :
Trying to install an exit handler that will check
some conditions to determine the proper exit code
for a PHP shell (CLI) script (unit test, used in
Makefile, should fail if someone in the tested code
somewhere call die("..."))
I found that the exit(status) call within the handler
ignores the status argument and sticks with the original
one; this obviously makes the ability to register a shutdown
function useless for my purpose (any idea on a workaround ?)
repro script:
<?php
function exit_override() {
echo "should exit with 1\n";
exit(1);
}
register_shutdown_function("exit_override");
die("calling die...");
?>
testing:
$ php ExitBug.php ; echo $?
calling die...should exit with 1
0
***
zero instead of the expected 1
I guess, if die("string") would actually imply exit(1) I wouldn't
need this workaround, but either way it seems that the last exit call
should override the shell return status code.
Thanks
Laurent
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23509&edit=1