On Mon, Apr 9, 2012 at 8:27 PM, Luke Scott <l...@cywh.com> wrote:
> Tom,
>
> On 4/9/12 4:47 PM, "Tom Boutell" <t...@punkave.com> wrote:
>
>>Let me be very clear about that... I am NOT proposing that <?php at
>>the top be mandatory in a file loaded in code mode! I don't want to
>>type it ever again outside of a template file, personally. See the
>>title of the RFC.
>
> And the problem is what exactly? Legacy code would be 5.4 code. PHP 5.3 is
> supported and code will be floating around for it for years to come. If I
> found a library on Github that was 5.4 compatible (starts with <?php) I
> don't want to remove the starting <?php just so my autoloader will read
> it. Ideally I'd like to be able to check out that code without touching it.

The RFC doesn't create this situation. .phpc files (by convention)
would be loaded in code-first mode, .php files (your existing 5.4
libraries) would be loaded in html-first mode. So the backwards
compatibility problem you describe doesn't exist in the RFC.

> Leaving out the starting <?php tag would be a much bigger security risk if
> loading code with an older version of PHP. An older version of PHP is
> going to see this code as plain text printed to the browser. In fact I
> would probably make sure my config files ALWAYS started with a <?php tag
> to ensure passwords were safe.

This would only be done in .phpc files, and those creating code for
reuse elsewhere would probably only use .phpc files in libraries of
reusable classes etc. Best practices put these outside the document
root where Apache would not have the potential to serve them.

Of course in a pure PHP 5.x environment you could choose to configure
Apache to serve .phpc files directly but I realize it would be a long
time before anyone considered it best practice to write entry point
.php files or PHP files containing passwords as .phpc files. Which is
fine, because it is not a common practice to have more than one or two
such in an entire framework-based application.

That said, allowing the skipping of an initial <?php tag at the top of
the file probably wouldn't be a big deal to implement in code mode.

-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to