Doc #60394 [Opn->Bgs]: Return value for json_encode() on failure not listed

From: Date: Sun, 27 Nov 2011 03:02:19 +0000
Subject: Doc #60394 [Opn->Bgs]: Return value for json_encode() on failure not listed
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7475@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60394&edit=1 ID: 60394 Updated by: frozenfire@php.net Reported by: papersnowman at gmail dot com Summary: Return value for json_encode() on failure not listed -Status: Open +Status: Bogus Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: This function is, surprisingly, properly documented. I was working on resolving this bug, when I checked the sources for the function, and found that there is no non-error situation where the function will return anything but an encoded string. The reason for this is all types can be encoded, including null. There are no values which you could pass to json_encode that would not result in a string being returned. The only way for it to fail is for you to not pass it an incorrect number of parameters, or some other error in syntax. Previous Comments: ------------------------------------------------------------------------ [2011-11-26 20:25:11] papersnowman at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.json-encode#refsect1-function.json- encode-returnvalues --- Documentation shows expected return value on success, but not failure. I would presume === false, but it is nice to be able to confirm. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60394&edit=1

« previous php.doc.bugs (#7475) next »