Re: Proposal for 2 new magic constants
| From: | Andrey Andreev | Date: | Sat, 23 May 2026 18:45:20 +0000 |
| Subject: | Re: Proposal for 2 new magic constants | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130994@lists.php.net to get a copy of this message | ||
Hi,
On Sat, May 23, 2026 at 8:23 PM Jordi Kroon <jordikroon@me.com> wrote:
>
> This kind of information is environment-specific and does not really
> belong as a language-level magic constant. Existing magic constants
> describe source context (
__FILE__,
> __DIR__, etc.), not host or user
> environment details.
>
> For CLI usage, this information is usually already available through
> environment variables such as HOME and UVˆÕ‚Ü€B
> ©±m�8JUSER, which is the more
> appropriate place for this kind of information.
>
I concur, and that settles the argument for me. However ...
> In isolated environments such as containers or chroots, exposing user or
> home-directory information is also something we generally should avoid.
>
> More importantly, I think we should discourage PHP web applications from
> reaching into other parts of the system and instead encourage them to
> stay within their application/web directories.
This default mindset of "PHP is for web and everything must conform to
that" is my biggest pet peeve on this list. It would serve PHP better to
not impede more general purpose use cases.
Cheers,
Andrey.