From: Arnaud Le Blanc Date: Tue, 26 May 2009 14:01:39 +0000 (+0000) Subject: MFH: Fix return value of pcntl_wexitstatus() (fixes #47566, X-Git-Tag: php-5.3.0RC3~137 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2b8b7f4e05cf5616547037de35d99e5104d169c;p=php MFH: Fix return value of pcntl_wexitstatus() (fixes #47566, patch by james at jamesreno dot com) --- diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index e5ce729b37..bee1693f1d 100755 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -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 diff --git a/ext/pcntl/tests/001.phpt b/ext/pcntl/tests/001.phpt index d83cae4468..fb1006e4bd 100644 --- a/ext/pcntl/tests/001.phpt +++ b/ext/pcntl/tests/001.phpt @@ -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 diff --git a/ext/pcntl/tests/bug47566.phpt b/ext/pcntl/tests/bug47566.phpt new file mode 100644 index 0000000000..8a69e6bc73 --- /dev/null +++ b/ext/pcntl/tests/bug47566.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #47566 (return value of pcntl_wexitstatus()) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(128)