PHP  
 PHP_5_5
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for Zend/tests/bug64979.phpt ('Bug #64979 (Wrong behavior of static variables in closure generators)')

Script

1: <?php
2:
3:
function new_closure_gen() {
4:     return function() {
5:         static 
$foo 0;
6:         
yield ++$foo;
7:     };
8: }
9:
10:
$closure1 new_closure_gen();
11:
$closure2 new_closure_gen();
12:
13:
$gen1 $closure1();
14:
$gen2 $closure1();
15:
$gen3 $closure2();
16:
17: foreach (array(
$gen1$gen2$gen3) as $gen) {
18:     foreach (
$gen as $val) {
19:         
var_dump($val);
20:     }
21: }
22:
23:
?>
24:

Expected

int(1)
int(2)
int(1)

Output

int(1)
int(1)
int(1)

Diff

002+ int(1)
002- int(2)

 

Generated at Sat, 12 Apr 2014 09:02:23 +0000 (6 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.