]> granicus.if.org Git - php/commitdiff
Disabled compile-time constant DOUBLE to STRING evaluation (its result depends on...
authorDmitry Stogov <dmitry@zend.com>
Tue, 18 Jul 2017 17:41:01 +0000 (20:41 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 18 Jul 2017 17:41:01 +0000 (20:41 +0300)
ext/opcache/Optimizer/zend_optimizer.c

index afd1c15597e57901439486834985649bf546f191..4b56809fda0086d17b23181b003cc90941e5a5c5 100644 (file)
@@ -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;
                        }