ID: 27749
Updated by: [EMAIL PROTECTED]
Reported By: kris dot hofmans at pandora dot be
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Linux 2.6
PHP Version: 5.0.0RC1
New Comment:
This is a new change. You now need to do self::MYCONST
to indicate you want the class's MYCONST.
Previous Comments:
------------------------------------------------------------------------
[2004-03-29 06:01:09] kris dot hofmans at pandora dot be
Description:
------------
I have been using the const in classes since the change from define,
this change seems to be reverted in RC1?
Since it doesn't recognize the constants, using define in the
constructor it works again, but I hope this is not the final behaviour.
Reproduce code:
---------------
class bleh {
const MYCONST = "hello world";
public function printMyConst(){
// doesn't work in RC1
print(MYCONST);
}
}
adding:
public function __construct(){
define("MYCONST", "hello world");
}
fixes it.
Expected result:
----------------
I hope const will be the default behaviour for php5, not reverting to
the deprecated php4 define method
Actual result:
--------------
Use of undefined constant ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27749&edit=1