1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/intl/tests/gh17469.phpt
David Carlier a1d1269688 Fix GH-17469: UConverter::transcode() not hardcoding error handling.
Respecting instead intl.use_exceptions/intl.error_level.

close GH-17488
2025-01-17 22:23:27 +00:00

35 lines
1004 B
PHP

--TEST--
GH-17469: UConverter::transcode() raises always E_WARNING regardless of INI settings
--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--
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 5
Error setting encoding: 4 - U_FILE_ACCESS_ERROR
Error setting encoding: 4 - U_FILE_ACCESS_ERROR