mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
Fix return value of pcntl_wextistatus() (fixes #47566,
patch by james at jamesreno dot com)
This commit is contained in:
parent
8b43f4fddc
commit
8620c10b3e
@ -607,9 +607,7 @@ PHP_FUNCTION(pcntl_wexitstatus)
|
||||
return;
|
||||
}
|
||||
|
||||
/* WEXITSTATUS only returns 8 bits so we *MUST* cast this to signed char
|
||||
if you want to have valid negative exit codes */
|
||||
RETURN_LONG((signed char) WEXITSTATUS(status_word));
|
||||
RETURN_LONG(WEXITSTATUS(status_word));
|
||||
#else
|
||||
RETURN_FALSE;
|
||||
#endif
|
||||
|
@ -73,7 +73,7 @@ test_stop_signal();
|
||||
Staring wait.h tests....
|
||||
|
||||
Testing pcntl_wifexited and wexitstatus....
|
||||
Exited With: -1
|
||||
Exited With: 255
|
||||
|
||||
Testing pcntl_wifsignaled....
|
||||
Process was terminated by signal : SIGTERM
|
||||
|
19
ext/pcntl/tests/bug47566.phpt
Normal file
19
ext/pcntl/tests/bug47566.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #47566 (return value of pcntl_wexitstatus())
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("pcntl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?
|
||||
$pid = pcntl_fork();
|
||||
if ($pid == -1) {
|
||||
echo "Unable to fork";
|
||||
exit;
|
||||
} elseif ($pid) {
|
||||
$epid = pcntl_waitpid(-1,$status);
|
||||
var_dump(pcntl_wexitstatus($status));
|
||||
} else {
|
||||
exit(128);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
int(128)
|
Loading…
Reference in New Issue
Block a user