From: Dmitry Stogov Date: Thu, 7 Dec 2017 19:01:41 +0000 (+0300) Subject: Cleanup type conversion X-Git-Tag: php-7.3.0alpha1~857 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f4a13095e27e3b3610e5f58d256a2b929f26962;p=php Cleanup type conversion --- diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index c61bb30edb..c5cc5c96cb 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -600,23 +600,19 @@ mysqlnd_stmt_execute_prepare_param_types(MYSQLND_STMT_DATA * stmt, zval ** copie to losing precision we need second variable. Conversion to double is to see if value is too big for a long. As said, precision could be lost. */ - zval tmp_data_copy; - ZVAL_COPY(&tmp_data_copy, tmp_data); - convert_to_double_ex(&tmp_data_copy); + double d = zval_get_double(tmp_data); /* if it doesn't fit in a long send it as a string. Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX We do transformation here, which will be used later when sending types. The code later relies on this. */ - if (Z_DVAL(tmp_data_copy) > ZEND_LONG_MAX || Z_DVAL(tmp_data_copy) < ZEND_LONG_MIN) { + if (d > ZEND_LONG_MAX || d < ZEND_LONG_MIN) { stmt->send_types_to_server = *resend_types_next_time = 1; convert_to_string_ex(tmp_data); } else { - convert_to_long_ex(tmp_data); + convert_to_long(tmp_data); } - - zval_ptr_dtor(&tmp_data_copy); } } } diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 5fe6c61494..94100dfc99 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -801,8 +801,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter) } intern = Z_XSL_P(id); if ((value = zend_hash_find(intern->parameter, name)) != NULL) { - convert_to_string_ex(value); - RETURN_STR_COPY(Z_STR_P(value)); + RETURN_STR(zval_get_string(value)); } else { RETURN_FALSE; }