Bug #81046 [NEW]: constant overwrite class method
| From: | felix at felix-kolbe dot de | Date: | Mon, 17 May 2021 11:39:18 +0000 |
| Subject: | Bug #81046 [NEW]: constant overwrite class method | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-233859@lists.php.net to get a copy of this message | ||
From: felix at felix-kolbe dot de
Operating system: Linux
PHP version: 8.0.6
Package: Class/Object related
Bug Type: Bug
Bug description:constant overwrite class method
Description:
------------
testet with 8.0.3 and 8.0.5
using a constant with upper-case(sic!) and the same name as a method
result in "Call to undefined method" (and vice versa method overwrite
constants)
Test script:
---------------
<?php
const fuN = 1;
new test;
class test{
public function __construct() {
fuN;
$this->fun(); // prints test->fun
$this->fuN(); //Call to undefined method test::fuN()
//fuN; coment this out for : Uncaught Error: Undefined constant "fuN"
}
function fun(){
echo "<p>" . __CLASS__ . "->" . __FUNCTION__ .
"</p>";
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=81046&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81046&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81046&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81046&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81046&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81046&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81046&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81046&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81046&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81046&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81046&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81046&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81046&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81046&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81046&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81046&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81046&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81046&r=mysqlcfg