|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-09-10 22:29 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2020-09-10 22:29 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 09:00:02 2025 UTC |
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."