summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/clone_with_symbol_table.phpt
blob: e1fefebd8fa42bbec1373f02330a035f96054c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--TEST--
A generator using a symbol table can be cloned
--FILE--
<?php

function gen() {
    // force compiled variable for $foo
    $foo = 'foo';

    // force symbol table
    extract(['foo' => 'bar']);

    // interrupt
    yield;

    var_dump($foo);
}

$g1 = gen();
$g1->rewind();
$g2 = clone $g1;
unset($g1);
$g2->next();

?>
--EXPECT--
string(3) "bar"