Bug #80089 [Opn->Nab]: Use of undefined constant is suddenly fatal
| From: | requinix@php.net | Date: | Thu, 10 Sep 2020 22:29:56 +0000 |
| Subject: | Bug #80089 [Opn->Nab]: Use of undefined constant is suddenly fatal | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228968@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80089&edit=1
ID: 80089
Updated by: requinix@php.net
Reported by: s dot wisselink at iwink dot nl
Summary: Use of undefined constant is suddenly fatal
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Debian
PHP Version: 8.0.0beta3
Block user comment: N
Private report: N
New Comment:
Correct.
https://github.com/php/php-src/blob/php-8.0.0beta3/UPGRADING#L35
Previous Comments:
------------------------------------------------------------------------
[2020-09-10 22:27:48] s dot wisselink at iwink dot nl
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 this bug report at https://bugs.php.net/bug.php?id=80089&edit=1