Re: Deprecate Undefined Constant Usage in php.ini Files (GH-20060)
| From: | Hans Krentel | Date: | Sun, 19 Oct 2025 19:47:25 +0000 |
| Subject: | Re: Deprecate Undefined Constant Usage in php.ini Files (GH-20060) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128869@lists.php.net to get a copy of this message | ||
On Sunday 19 October 2025 21:14:00 (+02:00), Tim Düsterhus wrote:
> Hi
>
> On 10/5/25 14:54, Hans Krentel wrote:
> > The php.ini file parser (as used by
parse_ini_file())
> > supports
> > constant resolution, including core predefined constants. However, the
> > current behavior with undefined constants is inconsistent with PHP 8's
> > strict handling of undefined constants in regular PHP code.
>
> How would PHP differentiate between “constants” and “unquoted strings”, the latter of
> which are explicitly supported (and encouraged) by the INI file format?
>
As it does today, no change. If you use a word that would expand to a constant name as it does
today, you need to quote it.
This preparatory step - if required - can be done in advance and the configuration file remains
forwards / backwards compatible so can be used across versions (e.g. configuration file templates).
Best,
-- hakre