ID:               42441
 Updated by:       [EMAIL PROTECTED]
 Reported By:      romain dot tartiere at healthgrid dot org
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: GNU/Linux
 PHP Version:      5.2.3
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




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

[2007-08-27 10:08:45] romain dot tartiere at healthgrid dot org

Description:
------------
If you use define to set the name of a class to a constant, you can't
use it to instanciate the class.

Reproduce code:
---------------
<?php
class foo {}

define('MYCLASS', 'foo');
$f = new MYCLASS();                  # Won't work
$f = new $_CONSTANTS['MYCLASS']();   # Won't work

$s = MYCLASS;
$f = new $s();                       # Works
?>

Expected result:
----------------
These way of instanciating the foo class should all work.

Actual result:
--------------
The two first syntax produce the same result:
Fatal error: Class name must be a valid object or a string


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


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

Reply via email to