summaryrefslogtreecommitdiff
path: root/ext/json/tests/bug73254.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/tests/bug73254.phpt')
-rw-r--r--ext/json/tests/bug73254.phpt21
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/json/tests/bug73254.phpt b/ext/json/tests/bug73254.phpt
new file mode 100644
index 0000000000..b043330cb7
--- /dev/null
+++ b/ext/json/tests/bug73254.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #73254 (Incorrect indentation generated by json_encode() with JSON_PRETTY_PRINT)
+--SKIPIF--
+<?php
+if (!extension_loaded('json')) die('skip');
+?>
+--FILE--
+<?php
+
+echo json_encode([json_encode([1], JSON_PRETTY_PRINT)]), "\n";
+
+$fp = fopen('php://temp', 'r');
+$data = ['a' => $fp];
+echo json_encode($data), "\n";
+echo json_encode([json_encode([1], JSON_PRETTY_PRINT)]), "\n";
+
+?>
+--EXPECT--
+["[\n 1\n]"]
+
+["[\n 1\n]"]