ID:               45077
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dimo414 at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows
 PHP Version:      5.2.6
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Class definitions are not supposed to be dynamic. And extending the
language in order to allow evals in classes definition would be a really
bad thing to do.


Previous Comments:
------------------------------------------------------------------------

[2008-05-23 07:14:20] dimo414 at gmail dot com

Description:
------------
Attempting to create a dynamic class definition using eval() to define
segments of the class on the fly, fails as PHP does not allow for eval()
to be called during class definition.  This may be more of a feature
request than a bug, but it would seem to me that PHP should allow eval()
to operate as normal inside class definitions.

Reproduce code:
---------------
class foo
{
  eval('var $bar;');
  
  function test($input)
  {
    $bar = $input;
  }
}

Expected result:
----------------
Should create a class called foo with one attribute, $bar, and a
constructor which takes one parameter.

Actual result:
--------------
Parse error: syntax error, unexpected T_EVAL, expecting T_FUNCTION in
W:\www\Internal\foo.class.php on line 3



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


-- 
Edit this bug report at http://bugs.php.net/?id=45077&edit=1

Reply via email to