com php-src: switch to smart str conversion routine to hide exact NAN type: Zend/zend_exceptions.c

[email protected] (Anatol Belski)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    fd521a22f75f248993d0696adf6f4f9be6557dda
Author:    Anatol Belski <[email protected]>         Tue, 7 Feb 2017 12:01:14 +0100
Parents:   8a8aa67844aa098abf98485329a16171f98b4a1c
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=fd521a22f75f248993d0696adf6f4f9be6557dda

Log:
switch to smart str conversion routine to hide exact NAN type

see https://github.com/php/php-src/pull/2356#issuecomment-277564135

Changed paths:
  M  Zend/zend_exceptions.c


Diff:
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index c95f39d..29b171b 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -556,8 +556,8 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */
 			break;
 		case IS_DOUBLE: {
 			double dval = Z_DVAL_P(arg);
-			char *s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
-			int l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval);  /* SAFE */
+			char *s_tmp;
+			size_t l_tmp = zend_spprintf(&s_tmp, MAX_LENGTH_OF_DOUBLE + EG(precision) + 1, "%.*G", (int) EG(precision), dval);  /* SAFE */
 			smart_str_appendl(str, s_tmp, l_tmp);
 			smart_str_appends(str, ", ");
 			efree(s_tmp);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.