Bug #73254 [Asn->Csd]: Incorrect indentation generated by json_encode() with JSON_PRETTY_PRINT
| From: | bukka@php.net | Date: | Sun, 30 Oct 2016 13:29:20 +0000 |
| Subject: | Bug #73254 [Asn->Csd]: Incorrect indentation generated by json_encode() with JSON_PRETTY_PRINT | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205070@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73254&edit=1
ID: 73254
Updated by: bukka@php.net
Reported by: robo006 at gmail dot com
Summary: Incorrect indentation generated by json_encode()
with JSON_PRETTY_PRINT
-Status: Assigned
+Status: Closed
Type: Bug
Package: JSON related
PHP Version: 7.1.0RC3
Assigned To: bukka
Block user comment: N
Private report: N
New Comment:
Fixed by http://git.php.net/?p=php-src.git;a=commit;h=c34de0b61c68bd77e324b869760a53abead4c5ed
Previous Comments:
------------------------------------------------------------------------
[2016-10-05 23:28:03] robo006 at gmail dot com
Description:
------------
After call
json_encode() that fails, all future json_encode() calls with
JSON_PRETTY_PRINT generates output with incorrect indentation.
See https://3v4l.org/reS06
Related: https://bugs.php.net/bug.php?id=66025
Test script:
---------------
<?php
echo json_encode([json_encode([1], JSON_PRETTY_PRINT)]), "\n";
$fp = fopen('php://stdin', 'r');
$data = ['a' => $fp];
echo json_encode($data), "\n";
echo json_encode([json_encode([1], JSON_PRETTY_PRINT)]), "\n";
Expected result:
----------------
["[\n 1\n]"]
["[\n 1\n]"]
Actual result:
--------------
["[\n 1\n]"]
["[\n 1\n ]"]
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73254&edit=1