Skip to content

Commit 93a9b56

Browse files
committed
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.
1 parent edf7346 commit 93a9b56

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ IntlTimeZone::getErrorCode/Message(): basic test
44
<?php
55
if (!extension_loaded('intl'))
66
die('skip intl extension not enabled');
7+
/* INF being an invalid offset depends on UB in float->int cast behavior. */
8+
$arch = php_uname('m');
9+
if ($arch != 'x86_64' && $arch != 'i386')
10+
die('skip requires x86');
11+
?>
712
--FILE--
813
<?php
914
ini_set("intl.error_level", E_WARNING);
@@ -28,4 +33,4 @@ Warning: IntlTimeZone::getOffset(): intltz_get_offset: error obtaining offset in
2833
bool(false)
2934
int(1)
3035
string(67) "intltz_get_offset: error obtaining offset: U_ILLEGAL_ARGUMENT_ERROR"
31-
==DONE==
36+
==DONE==

ext/intl/tests/timezone_getOffset_error.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ IntlTimeZone::getOffset(): errors
44
<?php
55
if (!extension_loaded('intl'))
66
die('skip intl extension not enabled');
7+
8+
/* INF being an invalid offset depends on UB in float->int cast behavior. */
9+
$arch = php_uname('m');
10+
if ($arch != 'x86_64' && $arch != 'i386')
11+
die('skip requires x86');
12+
?>
713
--FILE--
814
<?php
915
ini_set("intl.error_level", E_WARNING);

0 commit comments

Comments
 (0)