com php-src: Fix 73113 - Segfault with throwing JsonSerializable: ext/json/json.c
| From: | JulienPauli | Date: | Mon, 19 Sep 2016 13:16:14 +0000 |
| Subject: | com php-src: Fix 73113 - Segfault with throwing JsonSerializable: ext/json/json.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94583@lists.php.net to get a copy of this message | ||
Commit: b41abf7496039b24a9a6e0838350870fdc1d9367
Author: Julien Pauli <jpauli@php.net> Mon, 19 Sep 2016 15:01:54 +0200
Parents: 2efb1312104815b633e657410814b209ae8fabed
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b41abf7496039b24a9a6e0838350870fdc1d9367
Log:
Fix 73113 - Segfault with throwing JsonSerializable
Changed paths:
M ext/json/json.c
Diff:
diff --git a/ext/json/json.c b/ext/json/json.c
index 3bbe532..395f11d 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -230,7 +230,10 @@ static PHP_FUNCTION(json_encode)
ZVAL_FALSE(return_value);
} else {
smart_str_0(&buf); /* copy? */
- ZVAL_NEW_STR(return_value, buf.s);
+ if (buf.s) {
+ RETURN_NEW_STR(buf.s);
+ }
+ RETURN_EMPTY_STRING();
}
}
/* }}} */