Bug #80089 [NEW]: Use of undefined constant is suddenly fatal
| From: | s dot wisselink at iwink dot nl | Date: | Thu, 10 Sep 2020 22:27:48 +0000 |
| Subject: | Bug #80089 [NEW]: Use of undefined constant is suddenly fatal | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228966@lists.php.net to get a copy of this message | ||
From: s dot wisselink at iwink dot nl
Operating system: Debian
PHP version: 8.0.0beta3
Package: *General Issues
Bug Type: Bug
Bug description:Use of undefined constant is suddenly fatal
Description:
------------
In php8.0.0beta3, referencing an undefined constant throught the
constant function is fatal, whereas in php7.x it is not.
Test script:
---------------
```
$ php -v
PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
$ php -r "echo @constant('MYCONSTANT2');"
(no output)
```
whereas in php8
```
$ php -v
PHP 8.0.0beta3 (cli) (built: Sep 4 2020 20:24:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
$ php -r "echo @constant('MYCONSTANT2');"
Fatal error: Uncaught Error: Undefined constant "MYCONSTANT2" in Command
line code:1
Stack trace:
#0 Command line code(1): constant('MYCONSTANT2')
#1 {main}
thrown in Command line code on line 1
```
whereas the docs say: " [constant()] Returns the value of the constant,
or NULL if the constant is not defined."
--
Edit bug report at https://bugs.php.net/bug.php?id=80089&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80089&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80089&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80089&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80089&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80089&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80089&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80089&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80089&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80089&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80089&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80089&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80089&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80089&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80089&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80089&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80089&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80089&r=mysqlcfg