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