com php-src: Skip IntlTimeZone::getOffset() error tests on non-x86: ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
ext/intl/tests/timezone_getOffset_error.phpt
| From: | Nikita Popov | Date: | Thu, 24 Oct 2019 13:26:11 +0000 |
| Subject: | com php-src: Skip IntlTimeZone::getOffset() error tests on non-x86: ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt ext/intl/tests/timezone_getOffset_error.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109045@lists.php.net to get a copy of this message | ||
Commit: 93a9b56c90c334896e977721bfb3f38b1721cec6
Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 24 Oct 2019 14:41:05 +0200
Parents: edf7346810292967f41e60fb1474e09e1558862d
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=93a9b56c90c334896e977721bfb3f38b1721cec6
Log:
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.
Changed paths:
M ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
M ext/intl/tests/timezone_getOffset_error.phpt
Diff:
diff --git a/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
b/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
index d3a3dee47d1..18ffbe71bea 100644
--- a/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
+++ b/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
@@ -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==
\ No newline at end of file
+==DONE==
diff --git a/ext/intl/tests/timezone_getOffset_error.phpt
b/ext/intl/tests/timezone_getOffset_error.phpt
index d66716e552f..e984fc29f89 100644
--- a/ext/intl/tests/timezone_getOffset_error.phpt
+++ b/ext/intl/tests/timezone_getOffset_error.phpt
@@ -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);