|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-01-25 15:34 UTC] samding at ca dot ibm dot com
Description: ------------ Test case "ext/pcntl/tests/001.phpt" show it result on big_endian platform: " Staring wait.h tests.... Testing pcntl_wifexited and wexitstatus.... Exited With: 0 Testing pcntl_wifsignaled.... Testing pcntl_wifstopped and pcntl_wstopsig.... " Test script: --------------- sapi/cli/php ext/pcntl/tests/001.php Expected result: ---------------- "pcntl_wifexited" should return "255" Actual result: -------------- "pcntl_wifexited" should return "0" PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
See the code of "pcntl_wexitstatus" of ext/pcntl/pcntl.c 841 PHP_FUNCTION(pcntl_wexitstatus) 842 { 843 #ifdef WEXITSTATUS 844 zend_long status_word; 845 846 if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) { 847 return; 848 } 849 RETURN_LONG(WEXITSTATUS(status_word)); 850 #else 851 RETURN_FALSE; 852 #endif Here status_word is long, but WEXITSTATUS needs the input as int.(https://www.gnu.org/software/libc/manual/html_node/Process-Completion-Status.html) This is no problem on Little_Endian, but causes the problem on Big_Endian platform (s390x). Have to cast it to int before running macro WEXITSTATUS: 849 RETURN_LONG(WEXITSTATUS((int)status_word)); Similarly following function need to change: pcntl_wifexited pcntl_wifstopped pcntl_wifsignaled pcntl_wifcontinued pcntl_wexitstatus pcntl_wtermsig pcntl_wstopsig