Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:131026 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: by lists.php.net (Postfix, from userid 65534) id 086BB1A00BD; Wed, 27 May 2026 13:19:21 +0000 (UTC) To: internals@lists.php.net Date: Wed, 27 May 2026 08:19:20 -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] AW: [Pre-RFC] Pure-code source files via .phpc extension References: <9E95EA03-B86A-D248-A980-B1E838F94C13@hxcore.ol> 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 79pOonjHNTNuhjOPLlzai0ooWBtloDZfNGoFRVNNJv/hGvVM+wARAQABzRtCZW4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M1X7z3lAfoZotrWgjcGITmKchnJEGH+jbgqZAd+GkMaSPb1 DK2Owi0N9zkenK4iK59YQMS+1FQ2jl0LASxpM4Z8TTGltMlPf0zLfvl53G6zy7PSwWQb/9HW lriTmGFIiYCxyeMfpFgJxK3CLFq7qqF2bh4s8Z84m8qPDbW5XWgzEe+vZoCH In-Reply-To: <9E95EA03-B86A-D248-A980-B1E838F94C13@hxcore.ol> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 96.61.170.179 Message-ID: <20260527131921.086BB1A00BD@lists.php.net> From: ramsey@php.net (Ben Ramsey) On 5/27/26 07:12, hmennen90@gmail.com wrote: > Hi internals, > > I intend to submit an RFC introducing a new file extension for pure-code PHP > source files (no leading before drafting. > > Proposal in brief: > > Files ending in .phpc would be parsed starting in ST_IN_SCRIPTING state. No php or ?> tags permitted inside such files. Existing .php files and their > semantics are completely unchanged. This is purely additive and BC-clean. > > Motivation: > > PHP's mixed-mode default reflects its 1995 templating origins. Since PHP 7+, the > language has evolved into a credible general-purpose tool: strict types, enums, > readonly classes, property hooks, JIT compilation. I personally maintain > PHPolygon, a CPU-bound 3D engine written in PHP – a use case where the > templating heritage is pure ceremony. Other modern uses (CLI tooling, queue > workers, code generators) share this pattern. A dedicated pure-code file format > would be a small but meaningful acknowledgment that PHP-as-language is now a > first-class use case alongside PHP-as-template. > > Prior art and what's different: > > I have read both rfc/source_files_without_opening_tag (Boutell, 2012, abandoned > by author) and rfc/nophptags (Ohgaki, 2014, inactive). My proposal deliberately > avoids what I believe were the two design choices that killed them: > > - No new include syntax (Boutell's AS keyword). Extension-based detection only. > - No php.ini-based mode switch (Ohgaki's template_mode). No global config side > effects. > - No security framing. The mode-switch overhead is parse-time only and OPcache/ > JIT eliminate it in practice; this proposal is about conceptual clarity and > tooling, not performance or LFI mitigation. > > Implementation: > > I will write and maintain the implementation patch. Initial scope: extension > registration in zend_compile_file, lexer state initialization, OPcache > awareness, CLI support, and rejection of tokens inside .phpc files. I > will also coordinate with Composer maintainers ahead of RFC submission to > confirm autoload support. > > Open questions for the list: > > 1. Is the .phpc extension acceptable as the disambiguator, or is there appetite > for something else (e.g. shebang line, declare directive – both of which I think > are worse, but I'd hear the case)? > 2. Should #! shebang lines and UTF-8 BOM be permitted before the implicit > scripting state begins? My intent is yes for both. > 3. Should __halt_compiler() retain its current behavior in .phpc files? My > intent is yes. > > I welcome substantive critique. If the concept itself is unwanted, I would > rather know now than discover it during a vote. > > Thanks. > > Hendrik Mennen > Maintainer, PHPolygon > 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