summaryrefslogtreecommitdiff
path: root/ext/json/tests/bug68938.phpt
diff options
context:
space:
mode:
authorAdam Harvey <aharvey@php.net>2015-02-02 11:07:34 +0000
committerAdam Harvey <aharvey@php.net>2015-02-02 11:07:34 +0000
commita7b3abe4e6f5e2fdfd8d55b676c9ca6b3f9c8cc8 (patch)
tree7ac46431e85176df9b2a9a5e5a7bf7d8b5c16999 /ext/json/tests/bug68938.phpt
parentfb803ff81993eb8acde0cdd5f513b6253221c349 (diff)
downloadphp-git-a7b3abe4e6f5e2fdfd8d55b676c9ca6b3f9c8cc8.tar.gz
json_decode() should generate a syntax error when given "".
Fixes bug #68938 (json_decode() decodes empty string without error). Patch by jeremy at bat-country dot us.
Diffstat (limited to 'ext/json/tests/bug68938.phpt')
-rw-r--r--ext/json/tests/bug68938.phpt11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/json/tests/bug68938.phpt b/ext/json/tests/bug68938.phpt
new file mode 100644
index 0000000000..f6291ffe62
--- /dev/null
+++ b/ext/json/tests/bug68938.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #68938 (json_decode() decodes empty string without indicating error)
+--SKIPIF--
+<?php if (!extension_loaded("json")) print "skip"; ?>
+--FILE--
+<?php
+json_decode("");
+var_dump(json_last_error());
+?>
+--EXPECT--
+int(4)