Skip to content

Commit d87b068

Browse files
committed
Fixed bug #79600
Missed unsetting of DO_INIT in one case.
1 parent 3a3241c commit d87b068

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ PHP NEWS
66
. Fixed bug #79599 (coredump in set_error_handler). (Laruence)
77
. Fixed bug #79566 (Private SHM is not private on Windows). (cmb)
88
. Fixed bug #79489 (.user.ini does not inherit). (cmb)
9+
. Fixed bug #79600 (Regression in 7.4.6 when yielding an array based
10+
generator). (Nikita)
911

1012
- FFI:
1113
. Fixed bug #79571 (FFI: var_dumping unions may segfault). (cmb)
1214

1315
- Opcache:
1416
. Fixed bug #79588 (Boolean opcache settings ignore on/off values). (cmb)
17+
. Fixed bug #79548 (Preloading segfault with inherited method using static
18+
variable). (Nikita)
1519

1620
- SimpleXML:
1721
. Fixed bug #79528 (Different object of the same xml between 7.4.5 and

Zend/tests/generators/bug79600.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug #79600: Regression in 7.4.6 when yielding an array based generator
3+
--FILE--
4+
<?php
5+
6+
function createArrayGenerator() {
7+
yield from [
8+
1,
9+
2,
10+
];
11+
}
12+
13+
function createGeneratorFromArrayGenerator() {
14+
yield from createArrayGenerator();
15+
}
16+
17+
foreach (createGeneratorFromArrayGenerator() as $value) {
18+
echo $value, "\n";
19+
}
20+
21+
?>
22+
--EXPECT--
23+
1
24+
2

Zend/zend_generators.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ ZEND_API void zend_generator_resume(zend_generator *orig_generator) /* {{{ */
792792

793793
if (UNEXPECTED(!Z_ISUNDEF(generator->values))) {
794794
if (EXPECTED(zend_generator_get_next_delegated_value(generator) == SUCCESS)) {
795+
orig_generator->flags &= ~ZEND_GENERATOR_DO_INIT;
795796
return;
796797
}
797798
/* If there are no more deletegated values, resume the generator

0 commit comments

Comments
 (0)