]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.2' into PHP-7.3
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 28 Sep 2018 17:17:43 +0000 (19:17 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 28 Sep 2018 17:17:53 +0000 (19:17 +0200)
1  2 
NEWS
Zend/zend_generators.c

diff --cc NEWS
index 74dd9350143ca50e6984df0201d2f90c1bd4f5f0,eb845cbe695f79aedf68b233b88df792116af673..1f48fb5f17685b6d791ef62a28716f0da0405e02
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -5,16 -5,11 +5,17 @@@ PH
  - Core:
    . Fixed bug #76846 (Segfault in shutdown function after memory limit error).
      (Nikita)
+   . Fixed bug #76946 (Cyclic reference in generator not detected). (Nikita)
  
 -11 Oct 2018, PHP 7.2.11
 +27 Sep 2018, PHP 7.3.0RC2
 +
 +- CURL:
 +  . Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected).
 +    (Pierrick)
  
  - Core:
 +  . Fixed bug #76869 (Incorrect bypassing protected method accessibilty check).
 +    (Dmitry)
    . Fixed bug #76800 (foreach inconsistent if array modified during loop).
      (Dmitry)
    . Fixed bug #76901 (method_exists on SPL iterator passthrough method corrupts
index 0198b3171e66b2c4aa498f0236bd70be6434da5a,666a12fdebdc366cb80f11634178481187b20a80..1162c7653f05a1e738bd9fb7b3aa2461686a468c
@@@ -339,9 -356,26 +358,26 @@@ static HashTable *zend_generator_get_gc
                ZVAL_OBJ(gc_buffer++, Z_OBJ(execute_data->This));
        }
        if (EX_CALL_INFO() & ZEND_CALL_CLOSURE) {
 -              ZVAL_OBJ(gc_buffer++, (zend_object *) EX(func)->common.prototype);
 +              ZVAL_OBJ(gc_buffer++, ZEND_CLOSURE_OBJECT(EX(func)));
        }
  
+       if (execute_data->opline != op_array->opcodes) {
+               uint32_t i, op_num = execute_data->opline - op_array->opcodes - 1;
+               for (i = 0; i < op_array->last_live_range; i++) {
+                       const zend_live_range *range = &op_array->live_range[i];
+                       if (range->start > op_num) {
+                               break;
+                       } else if (op_num < range->end) {
+                               uint32_t kind = range->var & ZEND_LIVE_MASK;
+                               uint32_t var_num = range->var & ~ZEND_LIVE_MASK;
+                               zval *var = EX_VAR(var_num);
+                               if (kind == ZEND_LIVE_TMPVAR || kind == ZEND_LIVE_LOOP) {
+                                       ZVAL_COPY_VALUE(gc_buffer++, var);
+                               }
+                       }
+               }
+       }
        if (generator->node.children == 0) {
                zend_generator *root = generator->node.ptr.root;
                while (root != generator) {