From: Andrei Zmievski Date: Thu, 19 Oct 2006 20:24:25 +0000 (+0000) Subject: Clarify why the result of json_encode() is a binary string. X-Git-Tag: RELEASE_1_0_0RC1~1242 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2d9e83820ef55213d9dabdfd584a6f68f5a299c;p=php Clarify why the result of json_encode() is a binary string. --- diff --git a/ext/json/json.c b/ext/json/json.c index 20c3d72434..045ef35d1f 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -416,6 +416,10 @@ PHP_FUNCTION(json_encode) json_encode_r(&buf, parameter TSRMLS_CC); + /* + * Return as binary string, since the result is 99% likely to be just + * echo'ed out and we want to avoid overhead of double conversion. + */ ZVAL_STRINGL(return_value, buf.c, buf.len, 1); smart_str_free(&buf);