Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:131029 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: by lists.php.net (Postfix, from userid 65534) id C97961A00BD; Thu, 28 May 2026 02:31:49 +0000 (UTC) To: internals@lists.php.net Date: Wed, 27 May 2026 21:31:49 -0500 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] [Pre-RFC] Pure-code source files via .phpc extension References: <9E95EA03-B86A-D248-A980-B1E838F94C13@hxcore.ol> <20260527131921.086BB1A00BD@lists.php.net> <8AE9A269-2E40-42F0-A0F8-C6690B2935FE@gmail.com> Content-Language: en-US Autocrypt: addr=ramsey@php.net; keydata= xsFNBGCHQTYBEAC6IU9aXEpVuLJNAzXwL7q9Vt1PkxJHr7kJynUg/3ISrOdJy2Ebola7GbEd vLZ69o+NbsL5vmOmT2AD0pEGfMgE9KWJ122iEfN4hrWThz+sHcVd/TKX9E98g+HTpoJGtYcp 6jYxG0YRP7dn1zSn9CawVJpMsoS2G0JZB/q2lIELoPRLMjicRDBEfamTPi3vyYiuf4vvCcYY z3AEMYirt5f7rBrVOs3FVBozEqrN2fPRWvFgTnhsQ8MEiq5/DMsnxFq2wgheAKPIAXhZiJFo KHsrpiAANEmGZBY2pbW05rBY1ZmJpi1yCrSk582cdPo2Ca+NrNEPJ9spoEinAtApp/orirJY bjKViWqmh7mYYyv/NAQKwGBE1up3tSGVj0rKG3f9seLvYsApHf0lhEQN/ypzC+pYDlSXzWxc Q8bifixb6XulaEgB5XOHwuvpTK6HoNNdZM44Fl+B/eAXaebL6Vh0P1EN/2DBr4FGNb8vlXdv Gxs7rJbJ8+aNmYeNIdg5qbYubNsO2fU7yw9kTDNTej63Ql1a0Md2wfZze8dZy6LJ/tL//IH3 JPd0jvT1y0LVIKoYVrIfv06zolVplqi72zfec1kpw0VR6dT/LyhBlyNumqJMRHdZlX4pUCpx 79pO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G+6OXkVg3uIL5lnclGqVrkYke2xWSJs+ nb2qb6GKavsQWu0U2viSbOyB0M1X7z3lAfoZotrWgjcGITmKchnJEGH+jbgqZAd+GkMaSPb1 DK2Owi0N9zkenK4iK59YQMS+1FQ2jl0LASxpM4Z8TTGltMlPf0zLfvl53G6zy7PSwWQb/9HW lriTmGFIiYCxyeMfpFgJxK3CLFq7qqF2bh4s8Z84m8qPDbW5XWgzEe+vZoCH In-Reply-To: <8AE9A269-2E40-42F0-A0F8-C6690B2935FE@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 96.61.170.179 Message-ID: <20260528023149.C97961A00BD@lists.php.net> From: ramsey@php.net (Ben Ramsey) On 5/27/26 09:27, Hendrik Mennen wrote: > >> Am 27.05.2026 um 15:19 schrieb Ben Ramsey : >> >> The problem with assigning meaning to a file extension is that the >> interpreter (currently) doesn't care what the file extension is. As long >> as it's text, it'll process any file and execute what comes after any >> > Right, that is the current behavior, and changing it is exactly what the proposal is about. The engine would learn to check the file extension at the entry point (zend_compile_file for SAPI/CLI, and the include/require family for nested loads) and use that to set the initial lexer state. The .php behavior remains untouched. The behavior right now is that the file extension isn't checked. So, whether it's .php, .phtml, .php3, .rb, .py, or .txt doesn't matter. Using .php is a convention, not a requirement. If the proposal places any restrictions on the file extension, that's a major BC break. So, the logic will need to be something like: if .phpc, then parse assuming there are no That said, you point indirectly at something I do need to address: there are entry paths where the engine does not have a filename, or has one it should not trust. Off the top of my head: > > - stdin (cat foo.phpc | php). No filename available. Options: require an explicit CLI flag (php --pure), or simply not support this path and document it. > - eval(). Operates on strings, not files. Extension is irrelevant here; eval() continues to require - Phar archives. Internal entries have filenames, so dispatch by extension should work, but I would need to verify. > - include of a URL stream (rare, often disabled). Same question. Probably handled by extension on the URL path. > > I will work these out explicitly in the RFC draft. Thanks for surfacing it. > >> At the risk of bike-shedding, I think it could be easy for others to >> confuse .phpc files as byte-code files, since it's common to see Python >> byte-code files with the .pyc extension. > > Fair point, and one I had not weighed heavily enough. The Python .pyc parallel is real and would cause exactly the kind of one-time confusion that adds friction to adoption. Boutell's 2012 RFC used .phpp (Pure PHP) for the same purpose, which avoids the bytecode association. I am open to .phpp or other suggestions; the disambiguator matters less than the mechanism. I'm still unsure about assigning any meaning to the extension. Maybe this is something that could be handled at the SAPI configuration level similar to how .phps files are configured? Likewise, maybe the CLI should have a `-p` flag that tells it to process the input without checking for