Newsgroups: php.internals,php.internals Path: news.php.net Xref: news.php.net php.internals:130995 php.internals:130996 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: by lists.php.net (Postfix, from userid 65534) id 1C2751A00BD; Sat, 23 May 2026 18:57:15 +0000 (UTC) To: internals@lists.php.net,internals@lists.php.net Message-ID: Date: Sat, 23 May 2026 20:57:14 +0200 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Proposal for 2 new magic constants Content-Language: en-GB References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 86.92.4.88 From: jordikroon@me.com (Jordi Kroon) On 23/05/2026 8:42 pm, php@s22.us wrote: > Unless I'm missing something, I don't see the problem of having PHP > return that information, since it already does so.  E.g. __DIR__ will > return: > > /home/username/path/to/dir This assumes your project code lives somewhere in a subfolder within `$HOME`. In many situations, that is not the case at all. For example, it could simply be `/app`. Or, as a result of a chroot, `/home/username` may not be exposed at all. Instead, `__DIR__` would simply return `/path/to/dir`. > > Perhaps a magic constant would be the wrong way to do it, but in my > thinking, it would fit right in with __FILE__, __DIR__, etc. If it were to fit in with __FILE__, then it should be a magic constant. But I do not think it fits there. It should be an environment variable because it belongs to the runtime environment. -- Regards, Jordi Kroon