com php-src: Disabled compile-time constant DOUBLE to STRING evaluation (its result depends on run-time 'precision' setting):
ext/opcache/Optimizer/zend_optimizer.c
| From: | Dmitry Stogov | Date: | Tue, 18 Jul 2017 17:41:01 +0000 |
| Subject: | com php-src: Disabled compile-time constant DOUBLE to STRING evaluation (its result depends on run-time 'precision' setting): ext/opcache/Optimizer/zend_optimizer.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98617@lists.php.net to get a copy of this message | ||
Commit: c41d2535b1b4162de59f62bc52a74f7448ba0933
Author: Dmitry Stogov <dmitry@zend.com> Tue, 18 Jul 2017 20:41:01 +0300
Parents: b01448f9a60145b65d3635c81146be66f2fd0325
Branches: PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c41d2535b1b4162de59f62bc52a74f7448ba0933
Log:
Disabled compile-time constant DOUBLE to STRING evaluation (its result depends on run-time
'precision' setting)
Changed paths:
M ext/opcache/Optimizer/zend_optimizer.c
Diff:
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index afd1c15..4b56809 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -163,7 +163,9 @@ int zend_optimizer_eval_cast(zval *result, uint32_t type, zval *op1) /* {{{ */
ZVAL_DOUBLE(result, zval_get_double(op1));
return SUCCESS;
case IS_STRING:
- if (Z_TYPE_P(op1) != IS_ARRAY) {
+ /* Conversion from double to string takes into account run-time
+ 'precision' setting and cannot be evaluated at compile-time */
+ if (Z_TYPE_P(op1) != IS_ARRAY && Z_TYPE_P(op1) != IS_DOUBLE) {
ZVAL_STR(result, zval_get_string(op1));
return SUCCESS;
}