]> granicus.if.org Git - php/commitdiff
Fixed bug #79600
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 15 May 2020 09:03:05 +0000 (11:03 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 15 May 2020 09:04:40 +0000 (11:04 +0200)
Missed unsetting of DO_INIT in one case.

NEWS
Zend/tests/generators/bug79600.phpt [new file with mode: 0644]
Zend/zend_generators.c

diff --git a/NEWS b/NEWS
index 948e869ba906161ded3706a37654d21426ce6912..0e0a1e497df2b0173c079247708b4f10957276a5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,12 +6,16 @@ PHP                                                                        NEWS
   . Fixed bug #79599 (coredump in set_error_handler). (Laruence)
   . Fixed bug #79566 (Private SHM is not private on Windows). (cmb)
   . Fixed bug #79489 (.user.ini does not inherit). (cmb)
+  . Fixed bug #79600 (Regression in 7.4.6 when yielding an array based
+    generator). (Nikita)
 
 - FFI:
   . Fixed bug #79571 (FFI: var_dumping unions may segfault). (cmb)
 
 - Opcache:
   . Fixed bug #79588 (Boolean opcache settings ignore on/off values). (cmb)
+  . Fixed bug #79548 (Preloading segfault with inherited method using static
+    variable). (Nikita)
 
 - SimpleXML:
   . Fixed bug #79528 (Different object of the same xml between 7.4.5 and
diff --git a/Zend/tests/generators/bug79600.phpt b/Zend/tests/generators/bug79600.phpt
new file mode 100644 (file)
index 0000000..4abe978
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Bug #79600: Regression in 7.4.6 when yielding an array based generator
+--FILE--
+<?php
+
+function createArrayGenerator() {
+    yield from [
+        1,
+        2,
+    ];
+}
+
+function createGeneratorFromArrayGenerator() {
+    yield from createArrayGenerator();
+}
+
+foreach (createGeneratorFromArrayGenerator() as $value) {
+    echo $value, "\n";
+}
+
+?>
+--EXPECT--
+1
+2
index 9d8546f5185b34b6bfdcc2fb0293424be595b459..4cd9087303a3ff42a237b79bf57378578534983b 100644 (file)
@@ -792,6 +792,7 @@ try_again:
 
        if (UNEXPECTED(!Z_ISUNDEF(generator->values))) {
                if (EXPECTED(zend_generator_get_next_delegated_value(generator) == SUCCESS)) {
+                       orig_generator->flags &= ~ZEND_GENERATOR_DO_INIT;
                        return;
                }
                /* If there are no more deletegated values, resume the generator