summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/clone_with_this.phpt
blob: 66efd02987d775e958bbe631a0f1713b6156a9fb (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
--TEST--
Cloning a generator method (with $this)
--FILE--
<?php

class Test {
    protected $foo;

    public function gen() {
        $this->foo = 'bar';
        yield; // interrupt
        var_dump($this->foo);
    }
}

$g1 = (new Test)->gen();
$g1->rewind(); // goto yield
$g2 = clone $g1;
$g1->close();
$g2->next();

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