Skip to content

Commit 655ad9c

Browse files
committed
Do conversion locale-independently in a few other places
1 parent b571762 commit 655ad9c

File tree

6 files changed

+6
-16
lines changed

6 files changed

+6
-16
lines changed

Zend/zend_exceptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */
512512
smart_str_appends(str, ", ");
513513
break;
514514
case IS_DOUBLE: {
515-
smart_str_append_printf(str, "%.*G", (int) EG(precision), Z_DVAL_P(arg));
515+
smart_str_append_printf(str, "%.*H", (int) EG(precision), Z_DVAL_P(arg));
516516
smart_str_appends(str, ", ");
517517
break;
518518
}

Zend/zend_operators.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -605,12 +605,6 @@ ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op) /* {{{ */
605605
}
606606
/* }}} */
607607

608-
ZEND_API void ZEND_FASTCALL _convert_to_cstring(zval *op) /* {{{ */
609-
{
610-
_convert_to_string(op);
611-
}
612-
/* }}} */
613-
614608
ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op) /* {{{ */
615609
{
616610
try_again:
@@ -945,9 +939,7 @@ static zend_always_inline zend_string* __zval_get_string_func(zval *op, zend_boo
945939
return zend_long_to_str(Z_LVAL_P(op));
946940
}
947941
case IS_DOUBLE: {
948-
zend_string *str = zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), Z_DVAL_P(op));
949-
950-
return str;
942+
return zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), Z_DVAL_P(op));
951943
}
952944
case IS_ARRAY:
953945
zend_error(E_WARNING, "Array to string conversion");

Zend/zend_operators.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ ZEND_API int ZEND_FASTCALL increment_function(zval *op1);
257257
ZEND_API int ZEND_FASTCALL decrement_function(zval *op2);
258258

259259
ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op);
260-
ZEND_API void ZEND_FASTCALL _convert_to_cstring(zval *op);
261260
ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op);
262261
ZEND_API void ZEND_FASTCALL convert_to_long(zval *op);
263262
ZEND_API void ZEND_FASTCALL convert_to_double(zval *op);
@@ -340,7 +339,6 @@ static zend_always_inline zend_bool try_convert_to_string(zval *op) {
340339
#define _zval_get_double_func(op) zval_get_double_func(op)
341340
#define _zval_get_string_func(op) zval_get_string_func(op)
342341

343-
#define convert_to_cstring(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_cstring((op)); }
344342
#define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op)); }
345343

346344

ext/pgsql/pgsql.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ PHP_FUNCTION(pg_query_params)
19871987
zval tmp_val;
19881988

19891989
ZVAL_COPY(&tmp_val, tmp);
1990-
convert_to_cstring(&tmp_val);
1990+
convert_to_string(&tmp_val);
19911991
if (Z_TYPE(tmp_val) != IS_STRING) {
19921992
php_error_docref(NULL, E_WARNING,"Error converting parameter");
19931993
zval_ptr_dtor(&tmp_val);

ext/xmlrpc/libxmlrpc/xml_to_xmlrpc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ xml_element* XMLRPC_to_xml_element_worker(XMLRPC_VALUE current_vector, XMLRPC_VA
224224
case xmlrpc_double:
225225
{
226226
elem_val->name = estrdup(ELEM_DOUBLE);
227-
ap_php_snprintf(buf, BUF_SIZE, "%.*G", (int) EG(precision), XMLRPC_GetValueDouble(node));
227+
ap_php_snprintf(buf, BUF_SIZE, "%.*H", (int) EG(precision), XMLRPC_GetValueDouble(node));
228228
simplestring_add(&elem_val->text, buf);
229229
}
230230
break;

sapi/phpdbg/phpdbg_utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) {
676676
phpdbg_xml("<int refstatus=\"%s\" value=\"" ZEND_LONG_FMT "\" />", COMMON, Z_LVAL_P(zv));
677677
break;
678678
case IS_DOUBLE:
679-
phpdbg_xml("<float refstatus=\"%s\" value=\"%.*G\" />", COMMON, (int) EG(precision), Z_DVAL_P(zv));
679+
phpdbg_xml("<float refstatus=\"%s\" value=\"%.*H\" />", COMMON, (int) EG(precision), Z_DVAL_P(zv));
680680
break;
681681
case IS_STRING:
682682
phpdbg_xml("<string refstatus=\"%s\" length=\"%zd\" value=\"%.*s\" />", COMMON, Z_STRLEN_P(zv), (int) Z_STRLEN_P(zv), Z_STRVAL_P(zv));
@@ -801,7 +801,7 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */
801801
spprintf(&decode, 0, ZEND_LONG_FMT, Z_LVAL_P(zv));
802802
break;
803803
case IS_DOUBLE:
804-
spprintf(&decode, 0, "%.*G", 14, Z_DVAL_P(zv));
804+
spprintf(&decode, 0, "%.*H", 14, Z_DVAL_P(zv));
805805

806806
/* Make sure it looks like a float */
807807
if (zend_finite(Z_DVAL_P(zv)) && !strchr(decode, '.')) {

0 commit comments

Comments
 (0)