]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.0' into PHP-7.1
authorXinchen Hui <laruence@gmail.com>
Tue, 6 Dec 2016 09:32:48 +0000 (17:32 +0800)
committerXinchen Hui <laruence@gmail.com>
Tue, 6 Dec 2016 09:32:48 +0000 (17:32 +0800)
* PHP-7.0:
  Fixed bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created with list())

1  2 
Zend/zend_compile.c

index 63359dfa39059ea8c882398a24588d9c74e6c941,4b7b9979a5b0f2b403da6ea99b33bfd27e2961b6..2a8980f23b4809525e2b60ac8eb5f6921b895cf9
@@@ -3184,20 -2781,21 +3184,29 @@@ uint32_t zend_compile_args(zend_ast *as
                        }
                } else {
                        zend_compile_expr(&arg_node, arg);
-                       ZEND_ASSERT(arg_node.op_type != IS_CV);
                        if (arg_node.op_type == IS_VAR) {
 -                              opcode = ZEND_SEND_VAR_NO_REF;
 -                              if (fbc && ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
 -                                      flags |= ZEND_ARG_SEND_BY_REF;
 +                              /* pass ++$a or something similar */
 +                              if (fbc) {
 +                                      if (ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
 +                                              opcode = ZEND_SEND_VAR_NO_REF;
 +                                      } else if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) {
 +                                              opcode = ZEND_SEND_VAL;
 +                                      } else {
 +                                              opcode = ZEND_SEND_VAR;
 +                                      }
 +                              } else {
 +                                      opcode = ZEND_SEND_VAR_NO_REF_EX;
                                }
+                       } else if (arg_node.op_type == IS_CV) {
+                               if (fbc) {
+                                       if (ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
+                                               opcode = ZEND_SEND_REF;
+                                       } else {
+                                               opcode = ZEND_SEND_VAR;
+                                       }
+                               } else {
+                                       opcode = ZEND_SEND_VAR_EX;
+                               }
                        } else {
                                if (fbc) {
                                        opcode = ZEND_SEND_VAL;