summaryrefslogtreecommitdiff
path: root/tests/lang/bug21669.phpt
blob: 17db1081578935e73af2b94d239e4a9a277071f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--TEST--
Bug #21669 ("$obj = new $this->var;" doesn't work)
--FILE--
<?php
class Test {
    function say_hello() {
        echo "Hello world";
    }
}

class Factory {
    public $name = "Test";
    function create() {
        $obj = new $this->name; /* Parse error */
        return $obj;
    }
}
$factory = new Factory;
$test = $factory->create();
$test->say_hello();
?>
--EXPECT--
Hello world