1--TEST-- 2json_decode() tests 3--SKIPIF-- 4<?php if (!extension_loaded("json")) print "skip"; ?> 5--FILE-- 6<?php 7 8var_dump(json_decode()); 9var_dump(json_decode("")); 10var_dump(json_decode("", 1)); 11var_dump(json_decode("", 0)); 12var_dump(json_decode(".", 1)); 13var_dump(json_decode(".", 0)); 14var_dump(json_decode("<?>")); 15var_dump(json_decode(";")); 16var_dump(json_decode("руссиш")); 17var_dump(json_decode("blah")); 18var_dump(json_decode(NULL)); 19var_dump(json_decode('{ "test": { "foo": "bar" } }')); 20var_dump(json_decode('{ "test": { "foo": "" } }')); 21var_dump(json_decode('{ "": { "foo": "" } }')); 22var_dump(json_decode('{ "": { "": "" } }')); 23var_dump(json_decode('{ "": { "": "" }')); 24var_dump(json_decode('{ "": "": "" } }')); 25 26?> 27===DONE=== 28--EXPECTF-- 29Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d 30NULL 31NULL 32NULL 33NULL 34NULL 35NULL 36NULL 37NULL 38NULL 39NULL 40NULL 41object(stdClass)#%d (1) { 42 ["test"]=> 43 object(stdClass)#%d (1) { 44 ["foo"]=> 45 string(3) "bar" 46 } 47} 48object(stdClass)#%d (1) { 49 ["test"]=> 50 object(stdClass)#%d (1) { 51 ["foo"]=> 52 string(0) "" 53 } 54} 55object(stdClass)#%d (1) { 56 [""]=> 57 object(stdClass)#%d (1) { 58 ["foo"]=> 59 string(0) "" 60 } 61} 62object(stdClass)#%d (1) { 63 [""]=> 64 object(stdClass)#%d (1) { 65 [""]=> 66 string(0) "" 67 } 68} 69NULL 70NULL 71===DONE=== 72