#28005 [Opn->Bgs]: use of per class constants
| From: | derick@php.net | Date: | Thu, 15 Apr 2004 14:01:20 +0000 |
| Subject: | #28005 [Opn->Bgs]: use of per class constants | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58189@lists.php.net to get a copy of this message | ||
ID: 28005
Updated by: derick@php.net
Reported By: e dot vandeoudeweetering at marcanti dot esprit-sg dot
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: windows2000 (5.00.2195) sp4
PHP Version: 5.0.0RC1
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:
------------------------------------------------------------------------
[2004-04-15 07:28:44] e dot vandeoudeweetering at marcanti dot
esprit-sg dot
Description:
------------
This bug is related to: Bug #27523
It is not possible to use a class constant, without a reference to its
OWN class!
see reproduce code:
Another problem is that the function returns the name of the constant
instead of it's value!
Reproduce code:
---------------
<?php
class Test {
const TEMP = "hi";
function printConst() {
print "const Test::TEMP = " . Test::TEMP . "\n"; //works!
print "const TEMP = " . TEMP . "\n"; //produces notice
}
}
$t = new Test();
$t -> printConst();
?>
Expected result:
----------------
The following output should be printed:
const Test::TEMP = hi
const TEMP = hi
Actual result:
--------------
const Test::TEMP = hi
PHP Notice: Use of undefined constant TEMP - assumed 'TEMP' in
C:\Temp\test.php on line 8
const TEMP = TEMP
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28005&edit=1