mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00

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.
36 lines
876 B
PHP
36 lines
876 B
PHP
--TEST--
|
|
IntlTimeZone::getErrorCode/Message(): basic test
|
|
--SKIPIF--
|
|
<?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);
|
|
|
|
$lsb = IntlTimeZone::createTimeZone('Europe/Lisbon');
|
|
|
|
var_dump($lsb->getErrorCode());
|
|
var_dump($lsb->getErrorMessage());
|
|
|
|
var_dump($lsb->getOffset(INF, 1, $a, $b));
|
|
|
|
var_dump($lsb->getErrorCode());
|
|
var_dump($lsb->getErrorMessage());
|
|
|
|
?>
|
|
==DONE==
|
|
--EXPECTF--
|
|
int(0)
|
|
string(12) "U_ZERO_ERROR"
|
|
|
|
Warning: IntlTimeZone::getOffset(): intltz_get_offset: error obtaining offset in %s on line %d
|
|
bool(false)
|
|
int(1)
|
|
string(67) "intltz_get_offset: error obtaining offset: U_ILLEGAL_ARGUMENT_ERROR"
|
|
==DONE==
|