summaryrefslogtreecommitdiff
path: root/ext/json/tests
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2015-06-21 15:30:33 +0100
committerJakub Zelenka <bukka@php.net>2015-06-21 15:30:33 +0100
commitf3df3df8737ace9f4431416fdd0d312cb0ee9cfd (patch)
tree4d1031a3f6156ea1a83c94e39018118077f87d59 /ext/json/tests
parent115e9288bbd28f7ad525ebcc0053908464be5c95 (diff)
downloadphp-git-f3df3df8737ace9f4431416fdd0d312cb0ee9cfd.tar.gz
Fix bug #68546 (json_decode cannot access property started with \0)
Diffstat (limited to 'ext/json/tests')
-rw-r--r--ext/json/tests/bug68546.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/json/tests/bug68546.phpt b/ext/json/tests/bug68546.phpt
new file mode 100644
index 0000000000..f8c8d135f3
--- /dev/null
+++ b/ext/json/tests/bug68546.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Bug #68546 (json_decode() Fatal error: Cannot access property started with '\0')
+--SKIPIF--
+<?php
+
+if (!extension_loaded('json')) die('skip');
+?>
+--FILE--
+<?php
+
+var_dump(json_decode('{"key": {"\u0000": "aa"}}'));
+var_dump(json_last_error() === JSON_ERROR_INVALID_PROPERTY_NAME);
+var_dump(json_decode('[{"key1": 0, "\u0000": 1}]'));
+var_dump(json_last_error() === JSON_ERROR_INVALID_PROPERTY_NAME);
+var_dump(json_last_error_msg());
+
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+bool(true)
+NULL
+bool(true)
+string(36) "The decoded property name is invalid"
+Done