Re: RFC: source files without opening tag
| From: | Luke Scott | Date: | Tue, 10 Apr 2012 02:29:44 +0000 |
| Subject: | Re: RFC: source files without opening tag | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59600@lists.php.net to get a copy of this message | ||
On Apr 9, 2012, at 6:22 PM, Kris Craig <kris.craig@gmail.com> wrote:
If the default is "template mode" and the "<?php" tag is optional (at the
> top) in "code" mode there shouldn't be any problems.
>
> We don't need to change or leave out the tag entirely.
>
> Is there a problem with people being able to choose "template mode" or
> "code mode" as the default in the php.ini file if "template mode" is the
> default if not specified?
>
I think so, yes. A config option that causes massive BC breakage doesn't
become ok simply because it defaults to current behavior. I just can't
envision any situation in which having that option switched on would not
cause problems, unless that server is *only* running scripts that assume
code mode. However, what if you want to use two scripts, but one assumes
code and the other assumes HTML? The ini_set() function would be pretty
much useless given the circumstances.
Instead, I would have an optional <?phpp tag at the top of the file. This
would be in addition to the file extension/SAPI approach and the require
keyword approach. In other words, perhaps an "all of the above" strategy
is what's neeeded here. But either way, I just don't think an INI setting
would be feasible.
--Kris
Ini_set wouldn't work for this anyway. It would have to be changeable only
in php.ini.
Are you concerned a shared host us going to force code mode? Because
regardless of the default mode you can still do something like:
include "/foo/bar.php", INC_TEMPLATE;
If the php.ini option really spooks you, perhaps it can be specified by the
web server as an environmental variable.
In my case all requests (besides /public/* - purely static files) are feed
directly to index.php. I'd like to specify the mode in my Nginx config for
that index.php file.
Luke