From c2d9e83820ef55213d9dabdfd584a6f68f5a299c Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Thu, 19 Oct 2006 20:24:25 +0000 Subject: [PATCH] Clarify why the result of json_encode() is a binary string. --- ext/json/json.c | 4 ++++ 1 file changed, 4 insertions(+) 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); -- 2.50.1