php-src/ext/intl/tests/gh17469.phpt

37 lines
1.4 KiB
PHP

--TEST--
GH-17469: UConverter::transcode() raises always E_WARNING regardless of INI settings
--EXTENSIONS--
intl
--SKIPIF--
<?php
if (PHP_OS_FAMILY === "Windows") die("skip currently unsupported on Windows");
?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.use_exceptions", 0);
UConverter::transcode("\x0a", 'nein!!', 'UTF-8');
UConverter::transcode("\x0a", 'UTF-16BE', 'da!');
ini_set("intl.error_level", 0);
ini_set("intl.use_exceptions", 1);
try {
UConverter::transcode("\x0a", 'nein!!', 'UTF-8');
} catch (IntlException $e) {
echo $e->getMessage(), PHP_EOL;
}
try {
UConverter::transcode("\x0a", 'UTF-16BE', 'da!');
} catch (IntlException $e) {
echo $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Deprecated: ini_set(): Using a value different than 0 for intl.error_level is deprecated, as the intl.error_level INI setting is deprecated. Instead the intl.use_exceptions INI setting should be enabled to throw exceptions on errors or intl_get_error_code()/intl_get_error_message() should be used to manually deal with errors in %s on line %d
Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in %s on line %d
Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in %s on line %d
UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR
UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR