1--TEST-- 2htmlentities() / htmlspecialchars() ENT_SUBSTITUTE EUC-JP 3--FILE-- 4<?php 5$tests = array( 6 "\x8F\xA1\xFF", //2 sub as 2nd is potentially valid as lead 7 "\x8F\xA1", //2 sub, as 2nd is potentially valid as lead 8 "\x8F", //1 sub 9 "\x8F\xA0", //1 sub, A0 is not valid as sole/first byte 10 "\x8F\xA1\x21", //2 sub, no consume last 11 "\x8F\x21", //1 sub, no consume last 12 "\x8E\xAE", //valid 13 "\x8E", //1 sub 14 "\x8E\x21", //1 sub, no consume last 15 "\xB2\xFF", //1 sub 16 "\xB2", //1 sub 17 "\xB2\x21", //1 sub, no consume last 18 "\xA0", //1 sub 19); 20 21foreach ($tests as $test) { 22 $a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP"); 23 var_dump($a, bin2hex($a)); 24 $a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP"); 25 var_dump($a, bin2hex($a)); 26 echo "\n"; 27} 28?> 29--EXPECTF-- 30 31Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 32string(16) "��" 33string(32) "262378464646443b262378464646443b" 34string(16) "��" 35string(32) "262378464646443b262378464646443b" 36 37 38Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 39string(16) "��" 40string(32) "262378464646443b262378464646443b" 41string(16) "��" 42string(32) "262378464646443b262378464646443b" 43 44 45Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 46string(8) "�" 47string(16) "262378464646443b" 48string(8) "�" 49string(16) "262378464646443b" 50 51 52Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 53string(8) "�" 54string(16) "262378464646443b" 55string(8) "�" 56string(16) "262378464646443b" 57 58 59Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 60string(17) "��!" 61string(34) "262378464646443b262378464646443b21" 62string(17) "��!" 63string(34) "262378464646443b262378464646443b21" 64 65 66Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 67string(9) "�!" 68string(18) "262378464646443b21" 69string(9) "�!" 70string(18) "262378464646443b21" 71 72 73Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 74string(2) "��" 75string(4) "8eae" 76string(2) "��" 77string(4) "8eae" 78 79 80Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 81string(8) "�" 82string(16) "262378464646443b" 83string(8) "�" 84string(16) "262378464646443b" 85 86 87Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 88string(9) "�!" 89string(18) "262378464646443b21" 90string(9) "�!" 91string(18) "262378464646443b21" 92 93 94Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 95string(8) "�" 96string(16) "262378464646443b" 97string(8) "�" 98string(16) "262378464646443b" 99 100 101Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 102string(8) "�" 103string(16) "262378464646443b" 104string(8) "�" 105string(16) "262378464646443b" 106 107 108Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 109string(9) "�!" 110string(18) "262378464646443b21" 111string(9) "�!" 112string(18) "262378464646443b21" 113 114 115Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d 116string(8) "�" 117string(16) "262378464646443b" 118string(8) "�" 119string(16) "262378464646443b" 120