diff options
Diffstat (limited to 'ext/json/tests/fail001.phpt')
| -rw-r--r-- | ext/json/tests/fail001.phpt | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/ext/json/tests/fail001.phpt b/ext/json/tests/fail001.phpt index 1bf9f12106..ea203746a6 100644 --- a/ext/json/tests/fail001.phpt +++ b/ext/json/tests/fail001.phpt @@ -2,43 +2,44 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/fail*.json) --SKIPIF-- <?php - if (!extension_loaded('json')) die('skip: json extension not available'); + if (!extension_loaded('json')) die('skip'); ?> --FILE-- <?php -$tests = array('"A JSON payload should be an object or array, not a string."', - '["Unclosed array"', - '{unquoted_key: "keys must be quoted}', - '["extra comma",]', - '["double extra comma",,]', - '[ , "<-- missing value"]', - '["Comma after the close"],', - '["Extra close"]]', - '{"Extra comma": true,}', - '{"Extra value after close": true} "misplaced quoted value"', - '{"Illegal expression": 1 + 2}', - '{"Illegal invocation": alert()}', - '{"Numbers cannot have leading zeroes": 013}', - '{"Numbers cannot be hex": 0x14}', - '["Illegal backslash escape: \\x15"]', - '["Illegal backslash escape: \\\'"]', - '["Illegal backslash escape: \\017"]', - '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', - '{"Missing colon" null}', - '{"Double colon":: null}', - '{"Comma instead of colon", null}', - '["Colon instead of comma": false]', - '["Bad value", truth]', - "['single quote']"); +$tests = array( + '"A JSON payload should be an object or array, not a string."', + '["Unclosed array"', + '{unquoted_key: "keys must be quoted}', + '["extra comma",]', + '["double extra comma",,]', + '[ , "<-- missing value"]', + '["Comma after the close"],', + '["Extra close"]]', + '{"Extra comma": true,}', + '{"Extra value after close": true} "misplaced quoted value"', + '{"Illegal expression": 1 + 2}', + '{"Illegal invocation": alert()}', + '{"Numbers cannot have leading zeroes": 013}', + '{"Numbers cannot be hex": 0x14}', + '["Illegal backslash escape: \\x15"]', + '["Illegal backslash escape: \\\'"]', + '["Illegal backslash escape: \\017"]', + '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[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}', + '["Colon instead of comma": false]', + '["Bad value", truth]', + "['single quote']" +); -foreach ($tests as $test) -{ - echo 'Testing: ' . $test . "\n"; - echo "AS OBJECT\n"; - var_dump(json_decode($test)); - echo "AS ARRAY\n"; - var_dump(json_decode($test, true)); +foreach ($tests as $test) { + echo 'Testing: ' . $test . "\n"; + echo "AS OBJECT\n"; + var_dump(json_decode($test)); + echo "AS ARRAY\n"; + var_dump(json_decode($test, true)); } ?> |
