php-src/ext/mbstring/tests/mb_convert_encoding_failed_detection.phpt
Alex Dowad 97beecc251 Add identify filter for UTF-16, UTF-16LE, UTF-16BE
There was one faulty test in the suite which only passed before because UTF-16 had no
identify filter. After this was fixed, it exposed the problem with the test.
2020-10-13 20:26:13 +02:00

21 lines
508 B
PHP

--TEST--
mb_convert_encoding() when encoding detection fails
--INI--
mbstring.strict_detection=1
--FILE--
<?php
var_dump(mb_convert_encoding("\xff", "ASCII", ["UTF-8", "UTF-16"]));
$str = "\xff";
var_dump(mb_convert_variables("ASCII", ["UTF-8", "UTF-16"], $str));
var_dump(bin2hex($str));
?>
--EXPECTF--
Warning: mb_convert_encoding(): Unable to detect character encoding in %s on line %d
bool(false)
Warning: mb_convert_variables(): Unable to detect encoding in %s on line %d
bool(false)
string(2) "ff"