Bug #66027 [Opn->Csd]: json_encode returns 'null' string instead of false on error

From: Date: Sun, 03 Nov 2013 17:19:54 +0000
Subject: Bug #66027 [Opn->Csd]: json_encode returns 'null' string instead of false on error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182580@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66027&edit=1 ID: 66027 Updated by: nikic@php.net Reported by: vseticka dot martin at gmail dot com Summary: json_encode returns 'null' string instead of false on error -Status: Open +Status: Closed Type: Bug Package: JSON related Operating System: Windows PHP Version: 5.4.21 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: Has already been fixed in 5.5 Previous Comments: ------------------------------------------------------------------------ [2013-11-03 16:31:22] vseticka dot martin at gmail dot com Description: ------------ The script shows that json_encode function does not return FALSE on JSON_ERROR_UTF8 error as stated in manual page http://php.net/manual/en/function.json-encode.php but it returns "null" string. Test script: --------------- $result = json_encode(iconv('UTF-8', 'UCS-2', "Příliš žluťoučký kůň úpěl ďábelské ódy.")); var_dump(json_last_error()); var_dump($result); Expected result: ---------------- int(5) bool(false) Actual result: -------------- int(5) string(4) "null" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66027&edit=1

« previous php.bugs (#182580) next »