|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-27 10:22 UTC] jani@php.net
[2007-08-27 12:42 UTC] romain dot tartiere at healthgrid dot org
[2007-08-30 07:12 UTC] derick@php.net
[2007-08-30 08:58 UTC] romain dot tartiere at healthgrid dot org
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
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