From:             bartosz at webcity dot pl
Operating system: Linux
PHP version:      5CVS-2003-06-09 (dev)
PHP Bug Type:     *General Issues
Bug description:  Problem creating objects with names from class' fields

Analyse code below, it makes parse error:

<?php

class foobar2
{
      function foobar2()
      {
            echo phpversion();
      }
}

class foobar
{
      var $classname = 'foobar2';
      var $obj;

      function foobar()
      {
            // it works:
            //
            // $classname = $this -> classname;
            // $this -> obj = new $classname;
            //
            // but it doesn't work:

            $this -> obj = new $this -> classname;
      }
}

$obj = new foobar;

?>

----------------------------------------

My configure command:

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

Reply via email to