Re: [Pre-RFC] Pure-code source files via .phpc extension

From: Date: Thu, 04 Jun 2026 14:34:31 +0000
Subject: Re: [Pre-RFC] Pure-code source files via .phpc extension
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-131138@lists.php.net to get a copy of this message
On 04/06/2026 3:47 pm, Michael Morris wrote:
Question - what is the performance hit of scanning the file for <?php and, if none are found, restarting the parse process in code mode? 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. Additionally you would also need to scan for the <?= (short open tag). As others have mentioned a potential RFC would provide unncessary security and BC risks. That would most likely only surprise users. So I don't really see the real benefit of it. -- Regards, Jordi Kroon

« previous php.internals (#131138) next »