From: e dot vandeoudeweetering at marcanti dot esprit-sg dot nl
Operating system: windows2000 (5.00.2195) sp4
PHP version: 5.0.0RC1
PHP Bug Type: Class/Object related
Bug description: use of per class constants
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 bug report at http://bugs.php.net/?id=28005&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28005&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28005&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28005&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28005&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28005&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28005&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28005&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28005&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28005&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28005&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28005&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28005&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28005&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28005&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28005&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28005&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28005&r=float