From:             [EMAIL PROTECTED]
Operating system: Debian Linux 3.0r0
PHP version:      5CVS-2003-01-15 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  "$obj = new $this->var;" doesn't work

The following snippet is a parse error in PHP5-ZE2 (used to work on earlier
versions). This feature is also used in Smarty templates.

<?php
class Test {
        function say_hello() {
                echo "Hello world";
        }
}

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

-- 
Edit bug report at http://bugs.php.net/?id=21669&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21669&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21669&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21669&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21669&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21669&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21669&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21669&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21669&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21669&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21669&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21669&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21669&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21669&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21669&r=gnused

Reply via email to