]> granicus.if.org Git - php/commitdiff
- Add missing tests (thanks for being so fucking lazy Ilia!)
authorJani Taskinen <jani@php.net>
Tue, 22 Jul 2008 14:14:31 +0000 (14:14 +0000)
committerJani Taskinen <jani@php.net>
Tue, 22 Jul 2008 14:14:31 +0000 (14:14 +0000)
ext/json/tests/bug41504.phpt [new file with mode: 0644]
ext/json/tests/bug41567.phpt [new file with mode: 0644]

diff --git a/ext/json/tests/bug41504.phpt b/ext/json/tests/bug41504.phpt
new file mode 100644 (file)
index 0000000..bef4974
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+Bug #41504 (json_decode() converts empty array keys to "_empty_")
+--SKIPIF--
+<?php if (!extension_loaded('json')) print 'skip'; ?>
+--FILE--
+<?php
+
+var_dump(json_decode('{"":"value"}', true));
+var_dump(json_decode('{"":"value", "key":"value"}', true));
+var_dump(json_decode('{"key":"value", "":"value"}', true));
+
+echo "Done\n";
+?>
+--EXPECT--     
+array(1) {
+  [""]=>
+  string(5) "value"
+}
+array(2) {
+  [""]=>
+  string(5) "value"
+  ["key"]=>
+  string(5) "value"
+}
+array(2) {
+  ["key"]=>
+  string(5) "value"
+  [""]=>
+  string(5) "value"
+}
+Done
diff --git a/ext/json/tests/bug41567.phpt b/ext/json/tests/bug41567.phpt
new file mode 100644 (file)
index 0000000..5553df3
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Bug #41567 (json_encode() double conversion is inconsistent with PHP)
+--SKIPIF--
+<?php if (!extension_loaded('json')) print 'skip'; ?>
+--FILE--
+<?php
+
+$a = json_encode(123456789.12345);
+var_dump(json_decode($a));
+
+echo "Done\n";
+?>
+--EXPECT--     
+float(123456789.12345)
+Done