com php-src: Don't optimize (string) cast on arrays: ext/opcache/Optimizer/pass1_5.c
| From: | Nikita Popov | Date: | Fri, 09 Sep 2016 14:38:26 +0000 |
| Subject: | com php-src: Don't optimize (string) cast on arrays: ext/opcache/Optimizer/pass1_5.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94403@lists.php.net to get a copy of this message | ||
Commit: e3c08de08adac203140be2f7855b5749147c0411
Author: Nikita Popov <nikic@php.net> Fri, 9 Sep 2016 16:36:26 +0200
Parents: 7a90fc96d86c06f7a6b22a1a64c7d87042baf1fc
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e3c08de08adac203140be2f7855b5749147c0411
Log:
Don't optimize (string) cast on arrays
Otherwise we throw a notice during pass1_5 optimization.
Changed paths:
M ext/opcache/Optimizer/pass1_5.c
Diff:
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index 53abb5b..1a0fdb5 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -106,7 +106,9 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
if (ZEND_OP1_TYPE(opline) == IS_CONST &&
opline->extended_value != IS_ARRAY &&
opline->extended_value != IS_OBJECT &&
- opline->extended_value != IS_RESOURCE) {
+ opline->extended_value != IS_RESOURCE &&
+ (opline->extended_value != IS_STRING
+ || Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_ARRAY)) {
/* cast of constant operand */
zend_uchar type = opline->result_type;
uint32_t tv = ZEND_RESULT(opline).var; /* temporary variable */