summaryrefslogtreecommitdiff
path: root/tests/lang/bug21669.phpt
blob: 643b0695ee755906dcb1dbf3d3bc58e059a67583 (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