On Fri, Jan 19, 2018 at 4:04 PM, Sam Ding <samding@ca.ibm.com> wrote:
> The test case ext/standard/tests/general_functions/bug72300.phpt is failed
> on s390x.
> The function "ignore_user_abort" returns "256" on s390x, and "1" on x86_64
> after "ignore_user_abort" is set to true;
> The root reason is because of Big_Endian on s390x.
> Here is the C code: ext/standard/basic_functions.c
> b/ext/standard/basic_functions.c:5641
>
> old_setting = (unsigned short)PG(ignore_user_abort);
> // php_core_globals.ignore_user_abort, "x /2b" shows its
> value : "0x01 0x00" on both platforms
>
That specific line isn't the problem, as it's just cashing a short to
an unsigned short, which is legal and not problematic for any
endianness.
The actual problem is that PG(ignore_user_abort) is declared as a
short, but its INI handler method is defined as OnUpdateBool (which of
course, only operates on a single byte).
> Does PHP interpreter support Big_Endian? Are there any existing
> macros/functions to deal with Big/Little Endian?
>
Yep. And if things break on s390x, please let us know!
I'll put together a fix for this over the weekend and apply it to 7.0
and later versions.
-Sara