Skip IntlTimeZone::getOffset() error tests on non-x86

I'm not totally sure, but I have a strong suspicion that the fact
that this produces an error is an artifact of undefined cast behavior
(which will yield INDVAL on x86 but saturate on ARM). INF seems to
be the only value that results in an error even on x86 (variations
like -INF or NAN succeed).

It might make sense to just remove this test entirely, but for now
let's skip it on non-x86.
This commit is contained in:
Nikita Popov 2019-10-24 14:41:05 +02:00
parent edf7346810
commit 93a9b56c90
2 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,11 @@ IntlTimeZone::getErrorCode/Message(): basic test
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
/* INF being an invalid offset depends on UB in float->int cast behavior. */
$arch = php_uname('m');
if ($arch != 'x86_64' && $arch != 'i386')
die('skip requires x86');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
@ -28,4 +33,4 @@ Warning: IntlTimeZone::getOffset(): intltz_get_offset: error obtaining offset in
bool(false)
int(1)
string(67) "intltz_get_offset: error obtaining offset: U_ILLEGAL_ARGUMENT_ERROR"
==DONE==
==DONE==

View File

@ -4,6 +4,12 @@ IntlTimeZone::getOffset(): errors
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
/* INF being an invalid offset depends on UB in float->int cast behavior. */
$arch = php_uname('m');
if ($arch != 'x86_64' && $arch != 'i386')
die('skip requires x86');
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);