Annotation of embedaddon/php/ext/mbstring/tests/mb_regex_encoding_variation2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test mb_regex_encoding() function : usage variations - test different encodings
! 3: --SKIPIF--
! 4: <?php
! 5: extension_loaded('mbstring') or die('skip');
! 6: function_exists('mb_regex_encoding') or die("skip mb_regex_encoding() is not available in this build");
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: /* Prototype : string mb_regex_encoding([string $encoding])
! 11: * Description: Returns the current encoding for regex as a string.
! 12: * Source code: ext/mbstring/php_mbregex.c
! 13: */
! 14:
! 15: /*
! 16: * Test all listed encoding types from php.net to check all are known to function
! 17: * NB: The strings passed are *NOT* necessarily encoded in the encoding passed to the function.
! 18: * This test is purely to see whether the function recognises the encoding.
! 19: */
! 20:
! 21: echo "*** Testing mb_regex_encoding() : usage variations ***\n";
! 22:
! 23: $encoding = array('UCS-4', /*1*/
! 24: 'UCS-4BE',
! 25: 'UCS-4LE',
! 26: 'UCS-2',
! 27: 'UCS-2BE', /*5*/
! 28: 'UCS-2LE',
! 29: 'UTF-32',
! 30: 'UTF-32BE',
! 31: 'UTF-32LE',
! 32: 'UTF-16', /*10*/
! 33: 'UTF-16BE',
! 34: 'UTF-16LE',
! 35: 'UTF-7',
! 36: 'UTF7-IMAP',
! 37: 'UTF-8', /*15*/
! 38: 'ASCII',
! 39: 'EUC-JP',
! 40: 'SJIS',
! 41: 'eucJP-win',
! 42: 'SJIS-win', /*20*/
! 43: 'ISO-2022-JP',
! 44: 'JIS',
! 45: 'ISO-8859-1',
! 46: 'ISO-8859-2',
! 47: 'ISO-8859-3', /*25*/
! 48: 'ISO-8859-4',
! 49: 'ISO-8859-5',
! 50: 'ISO-8859-6',
! 51: 'ISO-8859-7',
! 52: 'ISO-8859-8', /*30*/
! 53: 'ISO-8859-9',
! 54: 'ISO-8859-10',
! 55: 'ISO-8859-13',
! 56: 'ISO-8859-14',
! 57: 'ISO-8859-15', /*35*/
! 58: 'byte2be',
! 59: 'byte2le',
! 60: 'byte4be',
! 61: 'byte4le',
! 62: 'BASE64', /*40*/
! 63: 'HTML-ENTITIES',
! 64: '7bit',
! 65: '8bit',
! 66: 'EUC-CN',
! 67: 'CP936', /*45*/
! 68: 'HZ',
! 69: 'EUC-TW',
! 70: 'CP950',
! 71: 'BIG-5',
! 72: 'EUC-KR', /*50*/
! 73: 'UHC',
! 74: 'ISO-2022-KR',
! 75: 'Windows-1251',
! 76: 'Windows-1252',
! 77: 'CP866', /*55*/
! 78: 'KOI8-R'); /*56*/
! 79:
! 80: $iterator = 1;
! 81: foreach($encoding as $enc) {
! 82: echo "\n-- Iteration $iterator --\n";
! 83: var_dump(mb_regex_encoding());
! 84: var_dump(mb_regex_encoding($enc));
! 85: var_dump(mb_regex_encoding());
! 86: $iterator++;
! 87: }
! 88: echo "Done";
! 89: ?>
! 90: --EXPECTF--
! 91: *** Testing mb_regex_encoding() : usage variations ***
! 92:
! 93: -- Iteration 1 --
! 94: string(%d) "%s"
! 95: bool(true)
! 96: string(5) "UCS-4"
! 97:
! 98: -- Iteration 2 --
! 99: string(5) "UCS-4"
! 100:
! 101: Warning: mb_regex_encoding(): Unknown encoding "UCS-4BE" in %s on line %d
! 102: bool(false)
! 103: string(5) "UCS-4"
! 104:
! 105: -- Iteration 3 --
! 106: string(5) "UCS-4"
! 107: bool(true)
! 108: string(7) "UCS-4LE"
! 109:
! 110: -- Iteration 4 --
! 111: string(7) "UCS-4LE"
! 112:
! 113: Warning: mb_regex_encoding(): Unknown encoding "UCS-2" in %s on line %d
! 114: bool(false)
! 115: string(7) "UCS-4LE"
! 116:
! 117: -- Iteration 5 --
! 118: string(7) "UCS-4LE"
! 119:
! 120: Warning: mb_regex_encoding(): Unknown encoding "UCS-2BE" in %s on line %d
! 121: bool(false)
! 122: string(7) "UCS-4LE"
! 123:
! 124: -- Iteration 6 --
! 125: string(7) "UCS-4LE"
! 126:
! 127: Warning: mb_regex_encoding(): Unknown encoding "UCS-2LE" in %s on line %d
! 128: bool(false)
! 129: string(7) "UCS-4LE"
! 130:
! 131: -- Iteration 7 --
! 132: string(7) "UCS-4LE"
! 133: bool(true)
! 134: string(5) "UCS-4"
! 135:
! 136: -- Iteration 8 --
! 137: string(5) "UCS-4"
! 138: bool(true)
! 139: string(5) "UCS-4"
! 140:
! 141: -- Iteration 9 --
! 142: string(5) "UCS-4"
! 143: bool(true)
! 144: string(7) "UCS-4LE"
! 145:
! 146: -- Iteration 10 --
! 147: string(7) "UCS-4LE"
! 148: bool(true)
! 149: string(6) "UTF-16"
! 150:
! 151: -- Iteration 11 --
! 152: string(6) "UTF-16"
! 153: bool(true)
! 154: string(6) "UTF-16"
! 155:
! 156: -- Iteration 12 --
! 157: string(6) "UTF-16"
! 158: bool(true)
! 159: string(8) "UTF-16LE"
! 160:
! 161: -- Iteration 13 --
! 162: string(8) "UTF-16LE"
! 163:
! 164: Warning: mb_regex_encoding(): Unknown encoding "UTF-7" in %s on line %d
! 165: bool(false)
! 166: string(8) "UTF-16LE"
! 167:
! 168: -- Iteration 14 --
! 169: string(8) "UTF-16LE"
! 170:
! 171: Warning: mb_regex_encoding(): Unknown encoding "UTF7-IMAP" in %s on line %d
! 172: bool(false)
! 173: string(8) "UTF-16LE"
! 174:
! 175: -- Iteration 15 --
! 176: string(8) "UTF-16LE"
! 177: bool(true)
! 178: string(5) "UTF-8"
! 179:
! 180: -- Iteration 16 --
! 181: string(5) "UTF-8"
! 182: bool(true)
! 183: string(5) "ASCII"
! 184:
! 185: -- Iteration 17 --
! 186: string(5) "ASCII"
! 187: bool(true)
! 188: string(6) "EUC-JP"
! 189:
! 190: -- Iteration 18 --
! 191: string(6) "EUC-JP"
! 192: bool(true)
! 193: string(4) "SJIS"
! 194:
! 195: -- Iteration 19 --
! 196: string(4) "SJIS"
! 197: bool(true)
! 198: string(6) "EUC-JP"
! 199:
! 200: -- Iteration 20 --
! 201: string(6) "EUC-JP"
! 202: bool(true)
! 203: string(4) "SJIS"
! 204:
! 205: -- Iteration 21 --
! 206: string(4) "SJIS"
! 207:
! 208: Warning: mb_regex_encoding(): Unknown encoding "ISO-2022-JP" in %s on line %d
! 209: bool(false)
! 210: string(4) "SJIS"
! 211:
! 212: -- Iteration 22 --
! 213: string(4) "SJIS"
! 214:
! 215: Warning: mb_regex_encoding(): Unknown encoding "JIS" in %s on line %d
! 216: bool(false)
! 217: string(4) "SJIS"
! 218:
! 219: -- Iteration 23 --
! 220: string(4) "SJIS"
! 221: bool(true)
! 222: string(10) "ISO-8859-1"
! 223:
! 224: -- Iteration 24 --
! 225: string(10) "ISO-8859-1"
! 226: bool(true)
! 227: string(10) "ISO-8859-2"
! 228:
! 229: -- Iteration 25 --
! 230: string(10) "ISO-8859-2"
! 231: bool(true)
! 232: string(10) "ISO-8859-3"
! 233:
! 234: -- Iteration 26 --
! 235: string(10) "ISO-8859-3"
! 236: bool(true)
! 237: string(10) "ISO-8859-4"
! 238:
! 239: -- Iteration 27 --
! 240: string(10) "ISO-8859-4"
! 241: bool(true)
! 242: string(10) "ISO-8859-5"
! 243:
! 244: -- Iteration 28 --
! 245: string(10) "ISO-8859-5"
! 246: bool(true)
! 247: string(10) "ISO-8859-6"
! 248:
! 249: -- Iteration 29 --
! 250: string(10) "ISO-8859-6"
! 251: bool(true)
! 252: string(10) "ISO-8859-7"
! 253:
! 254: -- Iteration 30 --
! 255: string(10) "ISO-8859-7"
! 256: bool(true)
! 257: string(10) "ISO-8859-8"
! 258:
! 259: -- Iteration 31 --
! 260: string(10) "ISO-8859-8"
! 261: bool(true)
! 262: string(10) "ISO-8859-9"
! 263:
! 264: -- Iteration 32 --
! 265: string(10) "ISO-8859-9"
! 266: bool(true)
! 267: string(11) "ISO-8859-10"
! 268:
! 269: -- Iteration 33 --
! 270: string(11) "ISO-8859-10"
! 271: bool(true)
! 272: string(11) "ISO-8859-13"
! 273:
! 274: -- Iteration 34 --
! 275: string(11) "ISO-8859-13"
! 276: bool(true)
! 277: string(11) "ISO-8859-14"
! 278:
! 279: -- Iteration 35 --
! 280: string(11) "ISO-8859-14"
! 281: bool(true)
! 282: string(11) "ISO-8859-15"
! 283:
! 284: -- Iteration 36 --
! 285: string(11) "ISO-8859-15"
! 286:
! 287: Warning: mb_regex_encoding(): Unknown encoding "byte2be" in %s on line %d
! 288: bool(false)
! 289: string(11) "ISO-8859-15"
! 290:
! 291: -- Iteration 37 --
! 292: string(11) "ISO-8859-15"
! 293:
! 294: Warning: mb_regex_encoding(): Unknown encoding "byte2le" in %s on line %d
! 295: bool(false)
! 296: string(11) "ISO-8859-15"
! 297:
! 298: -- Iteration 38 --
! 299: string(11) "ISO-8859-15"
! 300:
! 301: Warning: mb_regex_encoding(): Unknown encoding "byte4be" in %s on line %d
! 302: bool(false)
! 303: string(11) "ISO-8859-15"
! 304:
! 305: -- Iteration 39 --
! 306: string(11) "ISO-8859-15"
! 307:
! 308: Warning: mb_regex_encoding(): Unknown encoding "byte4le" in %s on line %d
! 309: bool(false)
! 310: string(11) "ISO-8859-15"
! 311:
! 312: -- Iteration 40 --
! 313: string(11) "ISO-8859-15"
! 314:
! 315: Warning: mb_regex_encoding(): Unknown encoding "BASE64" in %s on line %d
! 316: bool(false)
! 317: string(11) "ISO-8859-15"
! 318:
! 319: -- Iteration 41 --
! 320: string(11) "ISO-8859-15"
! 321:
! 322: Warning: mb_regex_encoding(): Unknown encoding "HTML-ENTITIES" in %s on line %d
! 323: bool(false)
! 324: string(11) "ISO-8859-15"
! 325:
! 326: -- Iteration 42 --
! 327: string(11) "ISO-8859-15"
! 328:
! 329: Warning: mb_regex_encoding(): Unknown encoding "7bit" in %s on line %d
! 330: bool(false)
! 331: string(11) "ISO-8859-15"
! 332:
! 333: -- Iteration 43 --
! 334: string(11) "ISO-8859-15"
! 335:
! 336: Warning: mb_regex_encoding(): Unknown encoding "8bit" in %s on line %d
! 337: bool(false)
! 338: string(11) "ISO-8859-15"
! 339:
! 340: -- Iteration 44 --
! 341: string(11) "ISO-8859-15"
! 342: bool(true)
! 343: string(6) "EUC-CN"
! 344:
! 345: -- Iteration 45 --
! 346: string(6) "EUC-CN"
! 347:
! 348: Warning: mb_regex_encoding(): Unknown encoding "CP936" in %s on line %d
! 349: bool(false)
! 350: string(6) "EUC-CN"
! 351:
! 352: -- Iteration 46 --
! 353: string(6) "EUC-CN"
! 354:
! 355: Warning: mb_regex_encoding(): Unknown encoding "HZ" in %s on line %d
! 356: bool(false)
! 357: string(6) "EUC-CN"
! 358:
! 359: -- Iteration 47 --
! 360: string(6) "EUC-CN"
! 361: bool(true)
! 362: string(6) "EUC-TW"
! 363:
! 364: -- Iteration 48 --
! 365: string(6) "EUC-TW"
! 366:
! 367: Warning: mb_regex_encoding(): Unknown encoding "CP950" in %s on line %d
! 368: bool(false)
! 369: string(6) "EUC-TW"
! 370:
! 371: -- Iteration 49 --
! 372: string(6) "EUC-TW"
! 373: bool(true)
! 374: string(4) "BIG5"
! 375:
! 376: -- Iteration 50 --
! 377: string(4) "BIG5"
! 378: bool(true)
! 379: string(6) "EUC-KR"
! 380:
! 381: -- Iteration 51 --
! 382: string(6) "EUC-KR"
! 383:
! 384: Warning: mb_regex_encoding(): Unknown encoding "UHC" in %s on line %d
! 385: bool(false)
! 386: string(6) "EUC-KR"
! 387:
! 388: -- Iteration 52 --
! 389: string(6) "EUC-KR"
! 390:
! 391: Warning: mb_regex_encoding(): Unknown encoding "ISO-2022-KR" in %s on line %d
! 392: bool(false)
! 393: string(6) "EUC-KR"
! 394:
! 395: -- Iteration 53 --
! 396: string(6) "EUC-KR"
! 397:
! 398: Warning: mb_regex_encoding(): Unknown encoding "Windows-1251" in %s on line %d
! 399: bool(false)
! 400: string(6) "EUC-KR"
! 401:
! 402: -- Iteration 54 --
! 403: string(6) "EUC-KR"
! 404:
! 405: Warning: mb_regex_encoding(): Unknown encoding "Windows-1252" in %s on line %d
! 406: bool(false)
! 407: string(6) "EUC-KR"
! 408:
! 409: -- Iteration 55 --
! 410: string(6) "EUC-KR"
! 411:
! 412: Warning: mb_regex_encoding(): Unknown encoding "CP866" in %s on line %d
! 413: bool(false)
! 414: string(6) "EUC-KR"
! 415:
! 416: -- Iteration 56 --
! 417: string(6) "EUC-KR"
! 418: bool(true)
! 419: string(5) "KOI8R"
! 420: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>