diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2011-06-01 09:44:38 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2011-06-01 09:44:38 +0000 |
commit | f4f2aa7583e19a63bf9c845b0bcb707bccb5cb19 (patch) | |
tree | 8325c10f16a3917c9c0b5784848a202e443f9efa /ext/json/tests | |
parent | cb7f656de78fa5732795542c53fc14aeb9faa525 (diff) | |
download | php-git-f4f2aa7583e19a63bf9c845b0bcb707bccb5cb19.tar.gz |
Fixed bug #54484 (Empty string in json_decode doesn't reset json_last_error()).
Diffstat (limited to 'ext/json/tests')
-rw-r--r-- | ext/json/tests/bug54484.phpt | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/json/tests/bug54484.phpt b/ext/json/tests/bug54484.phpt new file mode 100644 index 0000000000..a8f310885b --- /dev/null +++ b/ext/json/tests/bug54484.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #54484 (Empty string in json_decode doesn't reset json_last_error) +--SKIPIF-- +<?php if (!extension_loaded("json")) print "skip"; ?> +--FILE-- +<?php +json_decode('{"test":"test"}'); +var_dump(json_last_error()); + +json_decode(""); +var_dump(json_last_error()); + + +json_decode("invalid json"); +var_dump(json_last_error()); + + +json_decode(""); +var_dump(json_last_error()); +?> +--EXPECT-- +int(0) +int(0) +int(4) +int(0) +--TEST-- +Bug #54484 (Empty string in json_decode doesn't reset json_last_error) +--SKIPIF-- +<?php if (!extension_loaded("json")) print "skip"; ?> +--FILE-- +<?php +json_decode('{"test":"test"}'); +var_dump(json_last_error()); + +json_decode(""); +var_dump(json_last_error()); + + +json_decode("invalid json"); +var_dump(json_last_error()); + + +json_decode(""); +var_dump(json_last_error()); +?> +--EXPECT-- +int(0) +int(0) +int(4) +int(0) |