Annotation of embedaddon/php/ext/json/tests/bug64874_part1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitivity incorrectly")
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("json")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7: function decode($json) {
! 8: var_dump(json_decode($json));
! 9: var_dump(json_last_error() !== 0);
! 10: echo "\n";
! 11: }
! 12:
! 13: // Leading whitespace should be ignored
! 14: decode(" true");
! 15: decode("\ttrue");
! 16: decode("\ntrue");
! 17: decode("\rtrue");
! 18:
! 19: // So should trailing whitespace
! 20: decode("true ");
! 21: decode("true\t");
! 22: decode("true\n");
! 23: decode("true\r");
! 24:
! 25: // And so should the combination of both
! 26: decode(" true ");
! 27: decode(" true\t");
! 28: decode(" true\n");
! 29: decode(" true\r");
! 30: decode("\ttrue ");
! 31: decode("\ttrue\t");
! 32: decode("\ttrue\n");
! 33: decode("\ttrue\r");
! 34: decode("\ntrue ");
! 35: decode("\ntrue\t");
! 36: decode("\ntrue\n");
! 37: decode("\ntrue\r");
! 38: decode("\rtrue ");
! 39: decode("\rtrue\t");
! 40: decode("\rtrue\n");
! 41: decode("\rtrue\r");
! 42:
! 43: echo "Done\n";
! 44: --EXPECT--
! 45: bool(true)
! 46: bool(false)
! 47:
! 48: bool(true)
! 49: bool(false)
! 50:
! 51: bool(true)
! 52: bool(false)
! 53:
! 54: bool(true)
! 55: bool(false)
! 56:
! 57: bool(true)
! 58: bool(false)
! 59:
! 60: bool(true)
! 61: bool(false)
! 62:
! 63: bool(true)
! 64: bool(false)
! 65:
! 66: bool(true)
! 67: bool(false)
! 68:
! 69: bool(true)
! 70: bool(false)
! 71:
! 72: bool(true)
! 73: bool(false)
! 74:
! 75: bool(true)
! 76: bool(false)
! 77:
! 78: bool(true)
! 79: bool(false)
! 80:
! 81: bool(true)
! 82: bool(false)
! 83:
! 84: bool(true)
! 85: bool(false)
! 86:
! 87: bool(true)
! 88: bool(false)
! 89:
! 90: bool(true)
! 91: bool(false)
! 92:
! 93: bool(true)
! 94: bool(false)
! 95:
! 96: bool(true)
! 97: bool(false)
! 98:
! 99: bool(true)
! 100: bool(false)
! 101:
! 102: bool(true)
! 103: bool(false)
! 104:
! 105: bool(true)
! 106: bool(false)
! 107:
! 108: bool(true)
! 109: bool(false)
! 110:
! 111: bool(true)
! 112: bool(false)
! 113:
! 114: bool(true)
! 115: bool(false)
! 116:
! 117: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>