Annotation of embedaddon/php/ext/mbstring/tests/bug65045.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #65045: mb_convert_encoding breaks well-formed character
! 3: --SKIPIF--
! 4: <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: //declare(encoding = 'UTF-8');
! 9: mb_internal_encoding('UTF-8');
! 10:
! 11: $str = "\xF0\xA4\xAD". "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
! 12: $expected = "\xEF\xBF\xBD"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2";
! 13:
! 14: $str2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD";
! 15: $expected2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xEF\xBF\xBD";
! 16:
! 17: mb_substitute_character(0xFFFD);
! 18: var_dump(
! 19: $expected === htmlspecialchars_decode(htmlspecialchars($str, ENT_SUBSTITUTE, 'UTF-8')),
! 20: $expected2 === htmlspecialchars_decode(htmlspecialchars($str2, ENT_SUBSTITUTE, 'UTF-8')),
! 21: $expected === mb_convert_encoding($str, 'UTF-8', 'UTF-8'),
! 22: $expected2 === mb_convert_encoding($str2, 'UTF-8', 'UTF-8')
! 23: );
! 24:
! 25: --EXPECT--
! 26: bool(true)
! 27: bool(true)
! 28: bool(true)
! 29: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>