1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/mbstring/tests/bug65045.phpt
Jorg Adam Sowa 1e02099e6a ext/mbstring: Use internal_encoding INI setting instead of mb_internal_encoding() in tests (#19663)
Moves the usage of `mb_internal_encoding()` to INI section for the tests not testing the encoding/function itself, but the other mbstring/iconv functions.
2025-09-03 11:34:12 +01:00

26 lines
729 B
PHP

--TEST--
Bug #65045: mb_convert_encoding breaks well-formed character
--EXTENSIONS--
mbstring
--INI--
internal_encoding=UTF-8
--FILE--
<?php
$str = "\xF0\xA4\xAD". "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
$str2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD";
mb_substitute_character(0xFFFD);
echo bin2hex(htmlspecialchars_decode(htmlspecialchars($str, ENT_SUBSTITUTE, 'UTF-8'))), "\n";
echo bin2hex(htmlspecialchars_decode(htmlspecialchars($str2, ENT_SUBSTITUTE, 'UTF-8'))), "\n";
echo bin2hex(mb_convert_encoding($str, 'UTF-8', 'UTF-8')), "\n";
echo bin2hex(mb_convert_encoding($str2, 'UTF-8', 'UTF-8')), "\n";
?>
--EXPECT--
efbfbdf0a4ada2f0a4ada2
f0a4ada2f0a4ada2efbfbd
efbfbdf0a4ada2f0a4ada2
f0a4ada2f0a4ada2efbfbd