mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Finalize implode() patch
This commit is contained in:
parent
ffc3d4a076
commit
7c618c40bc
1 changed files with 4 additions and 5 deletions
|
@ -905,7 +905,7 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
|
|||
|
||||
case IS_LONG: {
|
||||
char stmp[MAX_LENGTH_OF_LONG + 1];
|
||||
str_len = sprintf(stmp, "%ld", Z_LVAL_PP(tmp));
|
||||
str_len = snprintf(stmp, sizeof(stmp), "%ld", Z_LVAL_PP(tmp));
|
||||
smart_str_appendl(&implstr, stmp, str_len);
|
||||
}
|
||||
break;
|
||||
|
@ -920,11 +920,10 @@ PHPAPI void php_implode(zval *delim, zval *arr, zval *return_value TSRMLS_DC)
|
|||
break;
|
||||
|
||||
case IS_DOUBLE: {
|
||||
char *stmp;
|
||||
stmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
|
||||
str_len = sprintf(stmp, "%.*G", (int) EG(precision), Z_DVAL_PP(tmp));
|
||||
char *stmp = (char *) do_alloca(MAX_LENGTH_OF_DOUBLE + EG(precision) + 2); /* +1 for decimal point */
|
||||
str_len = snprintf(stmp, sizeof(stmp), "%.*G", (int) EG(precision), Z_DVAL_PP(tmp));
|
||||
smart_str_appendl(&implstr, stmp, str_len);
|
||||
efree(stmp);
|
||||
free_alloca(stmp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue