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