mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00

If we fail to detect the encoding return false, just like mb_convert_encoding() does, and the implementation here clearly intended. Previously the "pass" pseudo-incoding was returned.
19 lines
472 B
PHP
19 lines
472 B
PHP
--TEST--
|
|
mb_convert_encoding() when encoding detection fails
|
|
--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"
|