Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Jan 16, 2025
1 parent ae3af5a commit d266695
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ext/intl/tests/gh17469.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--TEST--
GH-17469: UConverter::transcode() raises always E_WARNING regardless of INI settings
--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

0 comments on commit d266695

Please sign in to comment.