Bug #73254 [Opn->Asn]: Incorrect indentation generated by json_encode() with JSON_PRETTY_PRINT

From: Date: Thu, 06 Oct 2016 18:58:41 +0000
Subject: Bug #73254 [Opn->Asn]: Incorrect indentation generated by json_encode() with JSON_PRETTY_PRINT
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204517@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: Open +Status: Assigned Type: Bug Package: JSON related PHP Version: 7.1.0RC3 -Assigned To: +Assigned To: bukka Block user comment: N Private report: N 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

« previous php.bugs (#204517) next »