summaryrefslogtreecommitdiff
path: root/ext/json/tests
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2012-05-01 23:51:41 -0700
committerStanislav Malyshev <stas@php.net>2012-05-01 23:54:10 -0700
commit7bbd5521d28ee77c5a8df80174f52dad0112e872 (patch)
treeb35898ffd46a9c68d42a12f775b9a4e83b8379b6 /ext/json/tests
parent93192ec56df762341125f257cc61ab0c3e64ea76 (diff)
downloadphp-git-7bbd5521d28ee77c5a8df80174f52dad0112e872.tar.gz
Revert "Fix bug #61537 (json_encode() incorrectly truncates/discards information) and"
This reverts commit cb2a1c71c96d7c9b2ee03d77beae0c8e0d385f1b. The fix is not correct, not fixed after discussion on github. Please fix the issues and reapply the patch
Diffstat (limited to 'ext/json/tests')
-rw-r--r--ext/json/tests/bug43941.phpt21
-rw-r--r--ext/json/tests/bug54058.phpt7
-rw-r--r--ext/json/tests/bug61537.phpt30
3 files changed, 21 insertions, 37 deletions
diff --git a/ext/json/tests/bug43941.phpt b/ext/json/tests/bug43941.phpt
new file mode 100644
index 0000000000..0f86d1dfad
--- /dev/null
+++ b/ext/json/tests/bug43941.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #43941 (json_encode() invalid UTF-8)
+--SKIPIF--
+<?php if (!extension_loaded("json")) print "skip"; ?>
+--FILE--
+<?php
+
+var_dump(json_encode("abc"));
+var_dump(json_encode("ab\xE0"));
+var_dump(json_encode("ab\xE0c"));
+var_dump(json_encode(array("ab\xE0", "ab\xE0c", "abc")));
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(5) ""abc""
+string(4) "null"
+string(4) "null"
+string(17) "[null,null,"abc"]"
+Done
+
diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt
index 08c7f579ab..3b1136bdd9 100644
--- a/ext/json/tests/bug54058.phpt
+++ b/ext/json/tests/bug54058.phpt
@@ -29,14 +29,7 @@ json_encode($c);
var_dump(json_last_error());
?>
--EXPECTF--
-Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
int(5)
-
-Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
int(5)
-
-Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
int(5)
-
-Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
int(5)
diff --git a/ext/json/tests/bug61537.phpt b/ext/json/tests/bug61537.phpt
deleted file mode 100644
index e2abdda66a..0000000000
--- a/ext/json/tests/bug61537.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Bug #61537 (json_encode() incorrectly truncates/discards information)
---SKIPIF--
-<?php if (!extension_loaded("json")) print "skip"; ?>
---FILE--
-<?php
-$invalid_utf8 = "\x9f";
-var_dump(json_encode($invalid_utf8), json_last_error());
-var_dump(json_encode($invalid_utf8, JSON_PARTIAL_OUTPUT_ON_ERROR), json_last_error());
-
-$invalid_utf8 = "an invalid sequen\xce in the middle of a string";
-var_dump(json_encode($invalid_utf8), json_last_error());
-var_dump(json_encode($invalid_utf8, JSON_PARTIAL_OUTPUT_ON_ERROR), json_last_error());
-?>
---EXPECTF--
-Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
-bool(false)
-int(5)
-
-Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
-string(4) "null"
-int(5)
-
-Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
-bool(false)
-int(5)
-
-Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
-string(4) "null"
-int(5)