1--TEST-- 2HTML entities with invalid chars 3--INI-- 4output_handler= 5--FILE-- 6<?php 7@setlocale (LC_CTYPE, "C"); 8$strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x79", "\xE0\x80\xBE", 9 "Voil\xE0", "Clich\xE9s", 10 "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF", 11 "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD" 12 ); 13foreach($strings as $string) { 14 $sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8"); 15 var_dump(bin2hex($sc_encoded)); 16 $ent_encoded = htmlentities ($string, ENT_QUOTES, "utf-8"); 17 var_dump(bin2hex($ent_encoded)); 18} 19?> 20--EXPECTF-- 21string(8) "266c743b" 22string(8) "266c743b" 23string(0) "" 24string(0) "" 25string(4) "d090" 26string(4) "d090" 27string(0) "" 28string(0) "" 29string(8) "d090d0b0" 30string(8) "d090d0b0" 31string(0) "" 32string(0) "" 33string(0) "" 34string(0) "" 35string(0) "" 36string(0) "" 37string(0) "" 38string(0) "" 39string(0) "" 40string(0) "" 41string(0) "" 42string(0) "" 43string(0) "" 44string(0) "" 45string(0) "" 46string(0) "" 47string(0) "" 48string(0) "" 49string(4) "c3a9" 50string(16) "266561637574653b" 51string(0) "" 52string(0) "" 53string(0) "" 54string(0) "" 55string(0) "" 56string(0) "" 57string(0) "" 58string(0) "" 59string(0) "" 60string(0) "" 61string(0) "" 62string(0) "" 63string(0) "" 64string(0) "" 65string(0) "" 66string(0) "" 67string(0) "" 68string(0) "" 69string(0) "" 70string(0) "" 71