Skip to content

Commit d266695

Browse files
committed
add test
1 parent ae3af5a commit d266695

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

ext/intl/tests/gh17469.phpt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
GH-17469: UConverter::transcode() raises always E_WARNING regardless of INI settings
3+
--FILE--
4+
<?php
5+
ini_set("intl.error_level", E_WARNING);
6+
ini_set("intl.use_exceptions", 0);
7+
UConverter::transcode("\x0a", 'nein!!', 'UTF-8');
8+
UConverter::transcode("\x0a", 'UTF-16BE', 'da!');
9+
10+
ini_set("intl.error_level", 0);
11+
ini_set("intl.use_exceptions", 1);
12+
13+
try {
14+
UConverter::transcode("\x0a", 'nein!!', 'UTF-8');
15+
} catch (IntlException $e) {
16+
echo $e->getMessage(), PHP_EOL;
17+
}
18+
try {
19+
UConverter::transcode("\x0a", 'UTF-16BE', 'da!');
20+
} catch (IntlException $e) {
21+
echo $e->getMessage(), PHP_EOL;
22+
}
23+
?>
24+
--EXPECTF--
25+
26+
Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in %s on line %d
27+
28+
Warning: UConverter::transcode(): Error setting encoding: 4 - U_FILE_ACCESS_ERROR in %s on line 5
29+
Error setting encoding: 4 - U_FILE_ACCESS_ERROR
30+
Error setting encoding: 4 - U_FILE_ACCESS_ERROR

0 commit comments

Comments
 (0)