Re: [Pre-RFC] Pure-code source files via .phpc extension
| From: | Rowan Tommins [IMSoP] | Date: | Thu, 04 Jun 2026 15:22:32 +0000 |
| Subject: | Re: [Pre-RFC] Pure-code source files via .phpc extension | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131142@lists.php.net to get a copy of this message | ||
On 4 June 2026 15:34:31 BST, Jordi Kroon <jordikroon@me.com> wrote:
>On 04/06/2026 3:47 pm, Michael Morris wrote:
>> If the hit isn't significant, this might be a way forward. There is the BC break that
>> files fed through the parser with nothing to parse will start creating errors, but that situation (a
>> php file with no <?php at all) feels like an error state anyway. Thoughts?
>
>It is wrong to assume a PHP file always contains PHP code. Many PHP files only contain HTML just
>because it is totally valid to do so. Then the question is how to handle pure no-code files.
Rasmus (Lerdorf, PHP's creator) likes to point out that PHP has the shortest "hello world
application" of any non-esoteric language:
Hello, World!
More realistically, I just checked the codebase I work on with "ack" (a grep replacement):
ack --php -L '<\?'
That found 14 files which will be run as PHP but don't contain the string "<?".
Some of those are empty files, but about half are "templates" which happen not to have any
dynamic content.
So yeah, it would be an entirely unnecessary disruption to perfectly good code.
Regards,
Rowan Tommins
[IMSoP]