mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
24 lines
363 B
PHP
24 lines
363 B
PHP
--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
|