Welcome! Log In Create A New Profile

Advanced

[PHP-DEV] Big_Endian problem

Posted by Sam Ding 
Sam Ding
[PHP-DEV] Big_Endian problem
January 19, 2018 10:10PM
Hi all,

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

Does PHP interpreter support Big_Endian? Are there any existing
macros/functions to deal with Big/Little Endian?


Thanks,

Sam Ding
Sara Golemon
Re: [PHP-DEV] Big_Endian problem
January 19, 2018 11:10PM
On Fri, Jan 19, 2018 at 4:04 PM, Sam Ding <[email protected]> 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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Sam Ding
Re: [PHP-DEV] Big_Endian problem
January 22, 2018 03:50PM
Thank Sara.

Yes, on s390x, it is broken.
The function "ignore_user_abort" returns "256" on s390x, and "1" on x86_64
after "ignore_user_abort" is set to true;

Please let me know when you finished code changes on v7.2.1. I will test on
s390x.

Thanks,

Sam


php@golemon.com wrote on 01/19/2018 05:07:25 PM:

> From: Sara Golemon <[email protected]>
> To: Sam Ding <[email protected]>
> Cc: PHP internals <[email protected]>
> Date: 01/19/2018 05:07 PM
> Subject: Re: [PHP-DEV] Big_Endian problem
> Sent by: php@golemon.com
>
> On Fri, Jan 19, 2018 at 4:04 PM, Sam Ding <[email protected]> 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
>
Sara Golemon
Re: [PHP-DEV] Big_Endian problem
January 23, 2018 03:10PM
On Mon, Jan 22, 2018 at 9:40 AM, Sam Ding <[email protected]> wrote:
>
> Yes, on s390x, it is broken.
>
Yeah, I'd confirmed that one. I meant any *additional* issues are
welcome as well. :D

> The function "ignore_user_abort" returns "256" on s390x, and "1" on x86_64
> after "ignore_user_abort" is set to true;
>
> Please let me know when you finished code changes on v7.2.1. I will test on
> s390x.
>
Just got around to pushing:
https://github.com/php/php-src/commit/d46d53a7bcc99bb8d993852ef84e7a83d703f3db

Thanks!
-Sara

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login