[PHP-DEV] Bug #703: Parser Error occurs when on obj with constructor created with eval From: sheffield_e <email protected>
Date: 08/29/98

From: sheffield_e <email protected>
Operating system: Linux 2.0.33
PHP version: 3.0.3
PHP Bug Type: Parser error
Bug description:
This bug was discovered using the PHP Base Library with
PHP 3.0.3. Part of this library essentially performs a
call like:

eval('$GLOBALS["auth"]=new Album_Auth;');

The problem is that if Album_Auth has a constructor, then
a Parse Error occurs on the line containing the closing
'}' at the end of the class definition. If there is no
constructor, everything is fine.

A workaround I found was to modify the code so that the
call became:

eval('$GLOBALS["auth"]=$this->makeobject("Album_Auth");');

and I defined a the makeobject function as:

  function makeobject($obj) {
    return new $obj;
  }

This seems to work fine.

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>