<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PHP-DEV] RFC: source files without opening tag</title>
        <description>I have written an RFC proposing backwards-compatible support for
source files without an opening </description>
        <link>http://www.serverphorums.com/read.php?7,475424,475424#msg-475424</link>
        <lastBuildDate>Wed, 22 May 2013 15:01:08 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476744#msg-476744</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476744#msg-476744</link>
            <description><![CDATA[ On 10/04/12 19:22, Chris Stockton wrote:<br />
&gt; Hello,<br />
&gt; I understand your point that you are trying to make, but forward<br />
&gt; compatibility I am not sure shares the same critical nature as<br />
&gt; backwards. <br />
Sure, but if we can help with that when designing the feature, that's<br />
much better, and I think would also ecourage into using it.<br />
<br />
&gt; I think a software provider who is aiming at supporting a<br />
&gt; wide variety of php versions is likely going to code around the lowest<br />
&gt; common denominator.<br />
If they can easily work around it, it's much easier they start using it soon<br />
than waiting for when common web hostings stop providing 5.4.<br />
<br />
&gt;  Even still, if they chose to they could have two<br />
&gt; bootstrap files, one that included files with the new features and one<br />
&gt; with the old.<br />
Of course, they still could, but is more troublesome. Specially if as you<br />
suggest, they need to keep two files in sync. In that case it's probably<br />
easier<br />
to keep without the new features.<br />
<br />
<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Ángel González</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 22:50:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476623#msg-476623</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476623#msg-476623</link>
            <description><![CDATA[ Hello,<br />
<br />
2012/4/10 Ángel González &lt;keisial@gmail.com&gt;:<br />
&gt; Luke Scott wrote:<br />
&gt;&gt;&gt; if ( version_compare(PHP_VERSION, '5.5', '&lt;') )<br />
&gt;&gt;&gt;  include_once $file;<br />
&gt;&gt;&gt; else<br />
&gt;&gt;&gt;  require_code($file, array( 'once'=&gt;true, 'warn' =&gt; 'ignore' ) );<br />
&gt;&gt; I'm fairly certain that wouldn't work either. Require and friends are<br />
&gt;&gt; constructs, not functions.<br />
&gt;&gt;<br />
&gt;&gt; Luke<br />
&gt; I had assumed require_code would work with brackets around the parameters..<br />
&gt; Someone mentioned it, but you raise a good point in that it's not stated<br />
&gt; by the<br />
&gt; rfc, and would need to be explicitely supported.<br />
&gt;<br />
&gt; There are people calling require and friends with brackets, but that<br />
&gt; likely (ie.<br />
&gt; not looking at the lexer) works because the parameter is ('foo') which<br />
&gt; resolves<br />
&gt; as 'foo'. That wouldn't work when there are two of them.<br />
&gt; I think it should be something to consider when making the patch, though.<br />
&gt;<br />
&gt;<br />
<br />
I understand your point that you are trying to make, but forward<br />
compatibility I am not sure shares the same critical nature as<br />
backwards. I think a software provider who is aiming at supporting a<br />
wide variety of php versions is likely going to code around the lowest<br />
common denominator. Even still, if they chose to they could have two<br />
bootstrap files, one that included files with the new features and one<br />
with the old.<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Chris Stockton</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 19:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476572#msg-476572</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476572#msg-476572</link>
            <description><![CDATA[ Hello Chris,<br />
<br />
Chris Stockton wrote:<br />
&gt; I am not sure I am following you here Angel, are you confusing<br />
&gt; backwards and forward compatibility? <br />
It can probably be termed both ways, depending on which version you stay.<br />
I'm refering to the ability of a php file to work in both version 5.4<br />
and 5.5 yet<br />
take advantage of a 5.5 feature if available.<br />
<br />
<br />
&gt; I wouldn't expect a feature to ever work forward compatibly. <br />
&gt; I.E. Can't use traits in php 4 and can't<br />
&gt; play a blu ray disc in a dvd player. <br />
The introduction of a new function is a good example of compatibility. The<br />
code can easily detect and fall back<br />
<br />
function getRandomNumber() {<br />
 if (function_exists('rand'))<br />
    return rand();<br />
else<br />
    return 4; // chosen by fair dice roll, guaranteed to be random<br />
}<br />
<br />
<br />
or even show a graceful error message (instead of a cryptic php error):<br />
<br />
if ( version_compare(PHP_VERSION, '5.4', '&lt;') )<br />
  die(&quot;This program requires the awesome 5.4 version of PHP&quot;);<br />
<br />
class Foo {<br />
 use Bar;<br />
 ...<br />
}<br />
<br />
<br />
The later one is an example of what would *not* work, since even though<br />
the developer tried to show a clear error to the end user unexpectedly<br />
installing in an older php version than supported, he would get<br />
&quot;PHP Parse error:  syntax error, unexpected T_USE, expecting T_FUNCTION&quot;<br />
which in no way leads them to the &quot;You need to update PHP&quot; conclusion.<br />
<br />
<br />
<br />
&gt; The goal here is that if you have<br />
&gt; a large code base which has a hand rolled include_code function<br />
&gt; already, your change is backwards compatible with that code base. Same<br />
&gt; to be said for any constants, which is why I recommended using the<br />
&gt; reserved PHP_* space.<br />
The goal is to allow use of the new characteristics without having to drop<br />
support for old PHP versions, which is something typically done quite<br />
conservately.<br />
In this case, it would even be possible to make a userland include_code on<br />
old versions by falling back to an eval(). Not as good, but the codebase<br />
is still<br />
supporting the old PHP engines (back to X version).<br />
<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Ángel González</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 18:00:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476571#msg-476571</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476571#msg-476571</link>
            <description><![CDATA[ Luke Scott wrote:<br />
&gt;&gt; if ( version_compare(PHP_VERSION, '5.5', '&lt;') )<br />
&gt;&gt;  include_once $file;<br />
&gt;&gt; else<br />
&gt;&gt;  require_code($file, array( 'once'=&gt;true, 'warn' =&gt; 'ignore' ) );<br />
&gt; I'm fairly certain that wouldn't work either. Require and friends are<br />
&gt; constructs, not functions.<br />
&gt;<br />
&gt; Luke<br />
I had assumed require_code would work with brackets around the parameters.<br />
Someone mentioned it, but you raise a good point in that it's not stated<br />
by the<br />
rfc, and would need to be explicitely supported.<br />
<br />
There are people calling require and friends with brackets, but that<br />
likely (ie.<br />
not looking at the lexer) works because the parameter is ('foo') which<br />
resolves<br />
as 'foo'. That wouldn't work when there are two of them.<br />
I think it should be something to consider when making the patch, though.<br />
<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Ángel González</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 18:00:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476516#msg-476516</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476516#msg-476516</link>
            <description><![CDATA[ Yes, those points (keep the same keywords, optional second parameter,<br />
OR'd constants) have been made a few times, and I plan to edit the RFC<br />
accordingly.<br />
<br />
On Tue, Apr 10, 2012 at 10:53 AM, Luke Scott &lt;luke@cywh.com&gt; wrote:<br />
&gt; Tom,<br />
&gt;<br />
&gt; On Apr 10, 2012, at 6:48 AM, Tom Boutell &lt;tom@punkave.com&gt; wrote:<br />
&gt;<br />
&gt;&gt; The &quot;second part&quot; in the RFC is just a suggested filename convention,<br />
&gt;&gt; it is not a hardcoded requirement. I'm not sure that's what you're<br />
&gt;&gt; talking about here.<br />
&gt;&gt;<br />
&gt;&gt; The RFC I'm referring to does not propose completely removing the<br />
&gt;&gt; availability of the &lt;?php tag. There are two RFCs active. Please see:<br />
&gt;&gt;<br />
&gt;&gt; <a href="https://wiki.php.net/rfc/source_files_without_opening_tag" target="_blank"  rel="nofollow">https://wiki.php.net/rfc/source_files_without_opening_tag</a><br />
&gt;<br />
&gt; I would prefer to use the existing<br />
&gt; require/include/include_once/require_once keywords. Just add a second<br />
&gt; optional parameter to each.<br />
&gt;<br />
&gt; Also since these keywords are constructs it would be better to used<br />
&gt; or'd constants rather than an array.<br />
&gt;<br />
&gt; Luke<br />
&gt;<br />
&gt;&gt;<br />
&gt;&gt; On Tue, Apr 10, 2012 at 8:55 AM, Rafael Kassner &lt;kassner@gmail.com&gt; wrote:<br />
&gt;&gt;&gt; IMHO, both parts can be separated. My personal opinion: the require_path<br />
&gt;&gt;&gt; with the php mode only can be useful, a mime type or extension for these<br />
&gt;&gt;&gt; files too, but I'm not sure about removing &quot;&lt;?php&quot;. Maybe splitting it, the<br />
&gt;&gt;&gt; first part can be approved sooner than the second, or maybe the entire RFC<br />
&gt;&gt;&gt; would not be approved because the second.<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; On Tue, Apr 10, 2012 at 9:35 AM, Tom Boutell &lt;tom@punkave.com&gt; wrote:<br />
&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt; An important clarification: the RFC has two parts, NOT two options.<br />
&gt;&gt;&gt;&gt; Yasuo Ohgaki made many edits to the RFC before deciding to create his<br />
&gt;&gt;&gt;&gt; own RFC. He backed out most of his edits but somewhere along the line<br />
&gt;&gt;&gt;&gt; he introduced the words &quot;Option 1&quot; and &quot;Option 2&quot; for two things that<br />
&gt;&gt;&gt;&gt; are meant to go tegether. The intention is to have both the new<br />
&gt;&gt;&gt;&gt; functionality (the require_path keyword, or whatever that evolves<br />
&gt;&gt;&gt;&gt; into) AND a strongly encouraged naming convention for PHP files of the<br />
&gt;&gt;&gt;&gt; two types (see my original draft).<br />
&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt; I have corrected the RFC to read as intended.<br />
&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt; I'll be updating it with a second version shortly but wanted to clear<br />
&gt;&gt;&gt;&gt; up this confusion first.<br />
&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt; (I think it would be best for RFCs to have a single author of group of<br />
&gt;&gt;&gt;&gt; authors who are in agreement about the intent of the RFC. Proposing an<br />
&gt;&gt;&gt;&gt; alternative RFC, as Yasuo Ohgaki is now doing, is a much less<br />
&gt;&gt;&gt;&gt; confusing way to put forward a concept the original author does not<br />
&gt;&gt;&gt;&gt; agree with.)<br />
&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt; --<br />
&gt;&gt;&gt;&gt; Tom Boutell<br />
&gt;&gt;&gt;&gt; P'unk Avenue<br />
&gt;&gt;&gt;&gt; 215 755 1330<br />
&gt;&gt;&gt;&gt; punkave.com<br />
&gt;&gt;&gt;&gt; window.punkave.com<br />
&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt; --<br />
&gt;&gt;&gt;&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt;&gt;&gt;&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; --<br />
&gt;&gt;&gt; Atenciosamente,<br />
&gt;&gt;&gt; Rafael Kassner<br />
&gt;&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; Tom Boutell<br />
&gt;&gt; P'unk Avenue<br />
&gt;&gt; 215 755 1330<br />
&gt;&gt; punkave.com<br />
&gt;&gt; window.punkave.com<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt;&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;&gt;<br />
<br />
<br />
<br />
-- <br />
Tom Boutell<br />
P'unk Avenue<br />
215 755 1330<br />
punkave.com<br />
window.punkave.com<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Tom Boutell</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 17:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476506#msg-476506</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476506#msg-476506</link>
            <description><![CDATA[ Tom,<br />
<br />
On Apr 10, 2012, at 6:48 AM, Tom Boutell &lt;tom@punkave.com&gt; wrote:<br />
<br />
&gt; The &quot;second part&quot; in the RFC is just a suggested filename convention,<br />
&gt; it is not a hardcoded requirement. I'm not sure that's what you're<br />
&gt; talking about here.<br />
&gt;<br />
&gt; The RFC I'm referring to does not propose completely removing the<br />
&gt; availability of the &lt;?php tag. There are two RFCs active. Please see:<br />
&gt;<br />
&gt; <a href="https://wiki.php.net/rfc/source_files_without_opening_tag" target="_blank"  rel="nofollow">https://wiki.php.net/rfc/source_files_without_opening_tag</a><br />
<br />
I would prefer to use the existing<br />
require/include/include_once/require_once keywords. Just add a second<br />
optional parameter to each.<br />
<br />
Also since these keywords are constructs it would be better to used<br />
or'd constants rather than an array.<br />
<br />
Luke<br />
<br />
&gt;<br />
&gt; On Tue, Apr 10, 2012 at 8:55 AM, Rafael Kassner &lt;kassner@gmail.com&gt; wrote:<br />
&gt;&gt; IMHO, both parts can be separated. My personal opinion: the require_path<br />
&gt;&gt; with the php mode only can be useful, a mime type or extension for these<br />
&gt;&gt; files too, but I'm not sure about removing &quot;&lt;?php&quot;. Maybe splitting it, the<br />
&gt;&gt; first part can be approved sooner than the second, or maybe the entire RFC<br />
&gt;&gt; would not be approved because the second.<br />
&gt;&gt;<br />
&gt;&gt; On Tue, Apr 10, 2012 at 9:35 AM, Tom Boutell &lt;tom@punkave.com&gt; wrote:<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; An important clarification: the RFC has two parts, NOT two options.<br />
&gt;&gt;&gt; Yasuo Ohgaki made many edits to the RFC before deciding to create his<br />
&gt;&gt;&gt; own RFC. He backed out most of his edits but somewhere along the line<br />
&gt;&gt;&gt; he introduced the words &quot;Option 1&quot; and &quot;Option 2&quot; for two things that<br />
&gt;&gt;&gt; are meant to go tegether. The intention is to have both the new<br />
&gt;&gt;&gt; functionality (the require_path keyword, or whatever that evolves<br />
&gt;&gt;&gt; into) AND a strongly encouraged naming convention for PHP files of the<br />
&gt;&gt;&gt; two types (see my original draft).<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; I have corrected the RFC to read as intended.<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; I'll be updating it with a second version shortly but wanted to clear<br />
&gt;&gt;&gt; up this confusion first.<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; (I think it would be best for RFCs to have a single author of group of<br />
&gt;&gt;&gt; authors who are in agreement about the intent of the RFC. Proposing an<br />
&gt;&gt;&gt; alternative RFC, as Yasuo Ohgaki is now doing, is a much less<br />
&gt;&gt;&gt; confusing way to put forward a concept the original author does not<br />
&gt;&gt;&gt; agree with.)<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; --<br />
&gt;&gt;&gt; Tom Boutell<br />
&gt;&gt;&gt; P'unk Avenue<br />
&gt;&gt;&gt; 215 755 1330<br />
&gt;&gt;&gt; punkave.com<br />
&gt;&gt;&gt; window.punkave.com<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; --<br />
&gt;&gt;&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt;&gt;&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; Atenciosamente,<br />
&gt;&gt; Rafael Kassner<br />
&gt;&gt;<br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; Tom Boutell<br />
&gt; P'unk Avenue<br />
&gt; 215 755 1330<br />
&gt; punkave.com<br />
&gt; window.punkave.com<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Luke Scott</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 17:00:11 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476472#msg-476472</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476472#msg-476472</link>
            <description><![CDATA[ The &quot;second part&quot; in the RFC is just a suggested filename convention,<br />
it is not a hardcoded requirement. I'm not sure that's what you're<br />
talking about here.<br />
<br />
The RFC I'm referring to does not propose completely removing the<br />
availability of the &lt;?php tag. There are two RFCs active. Please see:<br />
<br />
<a href="https://wiki.php.net/rfc/source_files_without_opening_tag" target="_blank"  rel="nofollow">https://wiki.php.net/rfc/source_files_without_opening_tag</a><br />
<br />
On Tue, Apr 10, 2012 at 8:55 AM, Rafael Kassner &lt;kassner@gmail.com&gt; wrote:<br />
&gt; IMHO, both parts can be separated. My personal opinion: the require_path<br />
&gt; with the php mode only can be useful, a mime type or extension for these<br />
&gt; files too, but I'm not sure about removing &quot;&lt;?php&quot;. Maybe splitting it, the<br />
&gt; first part can be approved sooner than the second, or maybe the entire RFC<br />
&gt; would not be approved because the second.<br />
&gt;<br />
&gt; On Tue, Apr 10, 2012 at 9:35 AM, Tom Boutell &lt;tom@punkave.com&gt; wrote:<br />
&gt;&gt;<br />
&gt;&gt; An important clarification: the RFC has two parts, NOT two options.<br />
&gt;&gt; Yasuo Ohgaki made many edits to the RFC before deciding to create his<br />
&gt;&gt; own RFC. He backed out most of his edits but somewhere along the line<br />
&gt;&gt; he introduced the words &quot;Option 1&quot; and &quot;Option 2&quot; for two things that<br />
&gt;&gt; are meant to go tegether. The intention is to have both the new<br />
&gt;&gt; functionality (the require_path keyword, or whatever that evolves<br />
&gt;&gt; into) AND a strongly encouraged naming convention for PHP files of the<br />
&gt;&gt; two types (see my original draft).<br />
&gt;&gt;<br />
&gt;&gt; I have corrected the RFC to read as intended.<br />
&gt;&gt;<br />
&gt;&gt; I'll be updating it with a second version shortly but wanted to clear<br />
&gt;&gt; up this confusion first.<br />
&gt;&gt;<br />
&gt;&gt; (I think it would be best for RFCs to have a single author of group of<br />
&gt;&gt; authors who are in agreement about the intent of the RFC. Proposing an<br />
&gt;&gt; alternative RFC, as Yasuo Ohgaki is now doing, is a much less<br />
&gt;&gt; confusing way to put forward a concept the original author does not<br />
&gt;&gt; agree with.)<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; Tom Boutell<br />
&gt;&gt; P'unk Avenue<br />
&gt;&gt; 215 755 1330<br />
&gt;&gt; punkave.com<br />
&gt;&gt; window.punkave.com<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt;&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;&gt;<br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; Atenciosamente,<br />
&gt; Rafael Kassner<br />
&gt;<br />
<br />
<br />
<br />
-- <br />
Tom Boutell<br />
P'unk Avenue<br />
215 755 1330<br />
punkave.com<br />
window.punkave.com<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Tom Boutell</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 15:50:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476440#msg-476440</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476440#msg-476440</link>
            <description><![CDATA[ IMHO, both parts can be separated. My personal opinion: the require_path<br />
with the php mode only can be useful, a mime type or extension for these<br />
files too, but I'm not sure about removing &quot;&lt;?php&quot;. Maybe splitting it, the<br />
first part can be approved sooner than the second, or maybe the entire RFC<br />
would not be approved because the second.<br />
<br />
On Tue, Apr 10, 2012 at 9:35 AM, Tom Boutell &lt;tom@punkave.com&gt; wrote:<br />
<br />
&gt; An important clarification: the RFC has two parts, NOT two options.<br />
&gt; Yasuo Ohgaki made many edits to the RFC before deciding to create his<br />
&gt; own RFC. He backed out most of his edits but somewhere along the line<br />
&gt; he introduced the words &quot;Option 1&quot; and &quot;Option 2&quot; for two things that<br />
&gt; are meant to go tegether. The intention is to have both the new<br />
&gt; functionality (the require_path keyword, or whatever that evolves<br />
&gt; into) AND a strongly encouraged naming convention for PHP files of the<br />
&gt; two types (see my original draft).<br />
&gt;<br />
&gt; I have corrected the RFC to read as intended.<br />
&gt;<br />
&gt; I'll be updating it with a second version shortly but wanted to clear<br />
&gt; up this confusion first.<br />
&gt;<br />
&gt; (I think it would be best for RFCs to have a single author of group of<br />
&gt; authors who are in agreement about the intent of the RFC. Proposing an<br />
&gt; alternative RFC, as Yasuo Ohgaki is now doing, is a much less<br />
&gt; confusing way to put forward a concept the original author does not<br />
&gt; agree with.)<br />
&gt;<br />
&gt; --<br />
&gt; Tom Boutell<br />
&gt; P'unk Avenue<br />
&gt; 215 755 1330<br />
&gt; punkave.com<br />
&gt; window.punkave.com<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
&gt;<br />
<br />
<br />
-- <br />
Atenciosamente,<br />
Rafael Kassner]]></description>
            <dc:creator>Rafael Kassner</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 15:00:11 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476426#msg-476426</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476426#msg-476426</link>
            <description><![CDATA[ An important clarification: the RFC has two parts, NOT two options.<br />
Yasuo Ohgaki made many edits to the RFC before deciding to create his<br />
own RFC. He backed out most of his edits but somewhere along the line<br />
he introduced the words &quot;Option 1&quot; and &quot;Option 2&quot; for two things that<br />
are meant to go tegether. The intention is to have both the new<br />
functionality (the require_path keyword, or whatever that evolves<br />
into) AND a strongly encouraged naming convention for PHP files of the<br />
two types (see my original draft).<br />
<br />
I have corrected the RFC to read as intended.<br />
<br />
I'll be updating it with a second version shortly but wanted to clear<br />
up this confusion first.<br />
<br />
(I think it would be best for RFCs to have a single author of group of<br />
authors who are in agreement about the intent of the RFC. Proposing an<br />
alternative RFC, as Yasuo Ohgaki is now doing, is a much less<br />
confusing way to put forward a concept the original author does not<br />
agree with.)<br />
<br />
-- <br />
Tom Boutell<br />
P'unk Avenue<br />
215 755 1330<br />
punkave.com<br />
window.punkave.com<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Tom Boutell</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 14:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476352#msg-476352</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476352#msg-476352</link>
            <description><![CDATA[ On Tue, Apr 10, 2012 at 10:54 AM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
<br />
&gt; Hi,<br />
&gt;<br />
&gt; First of all, the proposal is threat mitigation and not for a<br />
&gt; complete countermeasure for LFI.<br />
&gt;<br />
<br />
yep, and I think that there is no transparent solution which would make<br />
impossible to havi LFI vulnerability without seriously crippling the<br />
language.<br />
<br />
<br />
&gt;<br />
&gt; 2012/4/10 Ferenc Kovacs &lt;tyra3l@gmail.com&gt;:<br />
&gt; &gt;&gt;<br />
&gt; &gt;&gt; &quot;allow_url_include&quot;  and  &quot;template_mode&quot; is similar to me.<br />
&gt; &gt;&gt;<br />
&gt; &gt;&gt; allow_url_include: enable only when url include is needed.<br />
&gt; &gt;&gt; template_mode:    enable only when template mode is needed.<br />
&gt; &gt;&gt;<br />
&gt; &gt;&gt; allow_url_include prevents RFI which may result in critical security<br />
&gt; &gt;&gt; incident.<br />
&gt; &gt;&gt; template_mode prevents LFI which may result in critical security<br />
&gt; incident.<br />
&gt; &gt;&gt;<br />
&gt; &gt;&gt; Note: template_mode=off is script only mode. On is current behavior.<br />
&gt; &gt;&gt;<br />
&gt; &gt;<br />
&gt; &gt; I just glanced over the RFC.<br />
&gt; &gt; See my comments below:<br />
&gt; &gt; &quot;LFI/RFI is fatal security error. Currently, LFI prevention is upto<br />
&gt; &gt; programmers and framework authors/system admins do not have feasible way<br />
&gt; to<br />
&gt; &gt; prevent LFI&quot;<br />
&gt; &gt; what about open_basedir?<br />
&gt;<br />
&gt; It's mitigation feature like template_mode=off.<br />
&gt;<br />
<br />
I think it should be mentioned, because now it sounds from the RFC that<br />
there is nothing available in this regard.<br />
<br />
<br />
&gt;<br />
&gt; &gt;<br />
&gt; &gt; &quot;Current PHP is weak to script injections compare to other languages<br />
&gt; such as<br />
&gt; &gt; Ruby/Perl/Phthon/Lua/etc.&quot;<br />
&gt; &gt; would be nice listing what does those languages do better in thise<br />
&gt; regard.<br />
&gt; &gt; AFAIK ruby allows you to include arbitrary files, and the rails security<br />
&gt; &gt; guides even mention the file upload<br />
&gt; &gt; vulnerability:<br />
&gt; <a href="http://guides.rubyonrails.org/security.html#executable-code-in-file-uploads" target="_blank"  rel="nofollow">http://guides.rubyonrails.org/security.html#executable-code-in-file-uploads</a><br />
&gt; &gt; perl also have require, Python has import, which is maybe a little bit<br />
&gt; &gt; harder to misuse, lua has both dofile and require.<br />
&gt; &gt; it would be nice explaining what do you mean by php being week compared<br />
&gt; to<br />
&gt; &gt; those languages.<br />
&gt;<br />
&gt; I know these language/framework may have similar vulnerability even Java<br />
&gt; had.<br />
&gt; What I would like to point out it &quot;LFI in PHP is *very* easy with<br />
&gt; respect to other<br />
&gt; languages due to embedded language nature&quot;.<br />
&gt;<br />
&gt; We can tell it from number of CVEs for LFIs.<br />
&gt; That's the reason why there would be better to have additional protection..<br />
&gt;<br />
<br />
maybe. but it can be accounted for other factors (like the popularity of<br />
the language, or the difference in the skill/knowledge of the average php<br />
developer/application vs the other languages).<br />
so I think it would be nice to explain what are those technical advantages<br />
the other languages have over php, instead of jumping to conclusion based<br />
on the number of the CVE numbers.<br />
<br />
<br />
<br />
&gt; &gt; I think that it would be really hard to adopt. Framework developers are<br />
&gt; &gt; trying to support the widest audience, and supporting both template_mode<br />
&gt; On<br />
&gt; &gt; and Off will be a major PITA imo.<br />
&gt;<br />
&gt; As I wrote in RFC example, supporting both is simple.<br />
&gt;<br />
&gt; 1. Disable template_mode=off in bootstrap, if they would like to enjoy<br />
&gt; mitigation.<br />
&gt; 2. Enable template_mode before render.<br />
&gt; 3. Disable template_mode after render.<br />
&gt;<br />
<br />
ok, so this would be an PHP_INI_ALL setting.<br />
of course if you would like to use this feature to prevent the injection of<br />
php code to the data files(and the execution), you should still have to<br />
disable the php_engine on the upload directory (or enable template_mode for<br />
that dir at least)<br />
so we can say that for public accessible/executable user uploads, this<br />
feature can't do much.<br />
<br />
<br />
&gt;<br />
&gt; &gt; I think it would require far less work to find and fix the LFIs and<br />
&gt; properly<br />
&gt; &gt; configure the webserver than rewriting your whole application (including<br />
&gt; &gt; your libraries).<br />
&gt; &gt;<br />
&gt; &gt; IDEs would be in the same spot, they can't tell you that whether or not<br />
&gt; your<br />
&gt; &gt; file is missing the opening tags without looking into your php.ini/apache<br />
&gt; &gt; vhost/.htaccess config.<br />
&gt; &gt; it can be either fine or a bug, depending on the value of template_mode<br />
&gt;<br />
&gt; I think you have missed RFC spec.<br />
&gt; Even when template_mode=off, &quot;&lt;?php&quot; at the beginning of script file is<br />
&gt; allowed for compatibility.<br />
&gt;<br />
<br />
yeah, I only noticed this later on, and didn't bothered to correct here.<br />
<br />
<br />
&gt;<br />
&gt; &gt; as Stas pointed out, if you migrate your codebase which depends on<br />
&gt; &gt; template_mode = Off, and you forgot to change the default php.ini (yeah,<br />
&gt; you<br />
&gt; &gt; should notice this before going live, but we are talking about the people<br />
&gt; &gt; having LFI and other vulns...) then your files will be served by your<br />
&gt; &gt; webserver as is. which itself can compromise your system.<br />
&gt;<br />
&gt; I think this could be verified easily by find and grep or IDE search.<br />
&gt; Modern script would not have needless PHP files under docroot also.<br />
&gt;<br />
<br />
yeah, but it is still a problem, that your IDE will be a hard time to<br />
properly catch.<br />
currently the &lt;?php ?&gt; tags are always available, if your RFC get's<br />
accepted, this can be turned off by runtime.<br />
<br />
<br />
&gt;<br />
&gt; &gt; &quot;With this RFC, the only allowed PHP tag under non embed mode is<br />
&gt; ”&lt;?php”.&quot;<br />
&gt;<br />
&gt; No. &lt;?php &lt;? &lt;% and others are allowed.<br />
&gt;<br />
<br />
yeah, this was another inconsistency in the RFC.<br />
<br />
<br />
&gt; Anyone wants &lt;script language=&quot;php&quot;&gt;?<br />
&gt;<br />
<br />
personally I don't. at all.<br />
<br />
<br />
&gt;<br />
&gt; &gt; oh, isn't that contradicting &quot;This RFC proposes removal of PHP tags<br />
&gt; (&lt;?php<br />
&gt; &gt; and so forth) from the PHP script by php.ini or CLI option flags.&quot; and<br />
&gt; &quot;Not<br />
&gt; &gt; a few programmers may once have been bothered to put a PHP tag at the<br />
&gt; top of<br />
&gt; &gt; every PHP script that only contains classes and functions. In short, PHP<br />
&gt; &gt; tags are just ancient.&quot;<br />
&gt; &gt; although it would lessen the BC/incompatibility problems mentioned above.<br />
&gt;<br />
&gt; Thanks for catching it.<br />
&gt; It was written for April Fool day by Moriyoshi.<br />
&gt; I should have edited his joke :)<br />
&gt;<br />
<br />
I think it would be better to leave as is, and create a separate RFC from<br />
the scratch, so that we don't have issues like this.<br />
<br />
<br />
&gt;<br />
&gt; &gt;<br />
&gt; &gt; In general I'm -1 on this RFC, I think that the people who are vulnerable<br />
&gt; &gt; wouldn't use it, and there are better alternatives for the described<br />
&gt; &gt; problems than the introduction of template_mode.<br />
&gt;<br />
&gt; Are there? I should have missed.<br />
&gt; What is the better alternative?<br />
&gt;<br />
<br />
personally I wouldn't need a solution which could in some but not all cases<br />
save me from my security bugs.<br />
this would be abused like safe_mode and magic_quotes was.<br />
false sense of security, which would make people lazy about fixing the real<br />
problem (LFI/RFI, executable file uploads, etc.)<br />
<br />
<br />
&gt;<br />
&gt; &gt; this would add an additional level of complexity and would make it<br />
&gt; harder to<br />
&gt; &gt; write portable code.<br />
&gt;<br />
&gt; This is misunderstanding.<br />
&gt; You might be felt by the part of April Fool's joke.<br />
&gt; I'll edit the part from now and please reconsider.<br />
&gt;<br />
<br />
I will re-read it tomorrow.<br />
<br />
<br />
-- <br />
Ferenc Kovács<br />
@Tyr43l - <a href="http://tyrael.hu" target="_blank"  rel="nofollow">http://tyrael.hu</a>]]></description>
            <dc:creator>Ferenc Kovacs</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 11:50:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476335#msg-476335</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476335#msg-476335</link>
            <description><![CDATA[ Hi,<br />
<br />
First of all, the proposal is threat mitigation and not for a<br />
complete countermeasure for LFI.<br />
<br />
2012/4/10 Ferenc Kovacs &lt;tyra3l@gmail.com&gt;:<br />
&gt;&gt;<br />
&gt;&gt; &quot;allow_url_include&quot;  and  &quot;template_mode&quot; is similar to me.<br />
&gt;&gt;<br />
&gt;&gt; allow_url_include: enable only when url include is needed.<br />
&gt;&gt; template_mode:    enable only when template mode is needed.<br />
&gt;&gt;<br />
&gt;&gt; allow_url_include prevents RFI which may result in critical security<br />
&gt;&gt; incident.<br />
&gt;&gt; template_mode prevents LFI which may result in critical security incident.<br />
&gt;&gt;<br />
&gt;&gt; Note: template_mode=off is script only mode. On is current behavior.<br />
&gt;&gt;<br />
&gt;<br />
&gt; I just glanced over the RFC.<br />
&gt; See my comments below:<br />
&gt; &quot;LFI/RFI is fatal security error. Currently, LFI prevention is upto<br />
&gt; programmers and framework authors/system admins do not have feasible way to<br />
&gt; prevent LFI&quot;<br />
&gt; what about open_basedir?<br />
<br />
It's mitigation feature like template_mode=off.<br />
<br />
&gt;<br />
&gt; &quot;Current PHP is weak to script injections compare to other languages such as<br />
&gt; Ruby/Perl/Phthon/Lua/etc.&quot;<br />
&gt; would be nice listing what does those languages do better in thise regard..<br />
&gt; AFAIK ruby allows you to include arbitrary files, and the rails security<br />
&gt; guides even mention the file upload<br />
&gt; vulnerability: <a href="http://guides.rubyonrails.org/security.html#executable-code-in-file-uploads" target="_blank"  rel="nofollow">http://guides.rubyonrails.org/security.html#executable-code-in-file-uploads</a><br />
&gt; perl also have require, Python has import, which is maybe a little bit<br />
&gt; harder to misuse, lua has both dofile and require.<br />
&gt; it would be nice explaining what do you mean by php being week compared to<br />
&gt; those languages.<br />
<br />
I know these language/framework may have similar vulnerability even Java had.<br />
What I would like to point out it &quot;LFI in PHP is *very* easy with<br />
respect to other<br />
languages due to embedded language nature&quot;.<br />
<br />
We can tell it from number of CVEs for LFIs.<br />
That's the reason why there would be better to have additional protection.<br />
<br />
&gt; &quot;PHP script inclusion detection may be done for data files. However, it's<br />
&gt; not a simple task.&quot;<br />
&gt; as I mentioned before, I don't think that it is the good way to try to<br />
&gt; detect the injected code in the data files:<br />
&gt; one should know beforehand that whether is the uploaded file is meant to be<br />
&gt; a data file or a script file, and act accordingly.<br />
&gt;<br />
&gt; &quot;Almost all applications are not checking these and it would be impossible<br />
&gt; to make developers do a proper validation.&quot;<br />
&gt; these kind of filtering techniques are error prone.<br />
<br />
Agreed.<br />
<br />
&gt;<br />
&gt; &quot;Disabling embed(template) mode is simple solution for this issue.&quot;<br />
&gt; one can still upload valid embed files and if the LFI is present, execute<br />
&gt; those.<br />
&gt;<br />
&gt; so your solution would only improve this problem, if an LFI vulnerability is<br />
&gt; present or the uploaded files are publically accessible and not excluded<br />
&gt; from the execution and the file uploads otherwise properly type validated<br />
&gt; and the developer choses to be compatible with the template_mode off and<br />
&gt; disables it(as the default would be on).<br />
<br />
Yes, it should be considered as mitigation. However, it is good one.<br />
<br />
&gt; I think that it would be really hard to adopt. Framework developers are<br />
&gt; trying to support the widest audience, and supporting both template_mode On<br />
&gt; and Off will be a major PITA imo.<br />
<br />
As I wrote in RFC example, supporting both is simple.<br />
<br />
1. Disable template_mode=off in bootstrap, if they would like to enjoy<br />
mitigation.<br />
2. Enable template_mode before render.<br />
3. Disable template_mode after render.<br />
<br />
For good frameworks, it will be a few lines of changes.<br />
<br />
&gt; and until they do, the average developer can't be expected to make his<br />
&gt; choice of framework compatible with template_mode off, so he/she won't use<br />
&gt; it.<br />
<br />
It would be easy enough for framework users to adopt template_mode.<br />
So they can make changes to framework. Perhaps, they could contribute<br />
it.<br />
<br />
&gt; I think it would require far less work to find and fix the LFIs and properly<br />
&gt; configure the webserver than rewriting your whole application (including<br />
&gt; your libraries).<br />
&gt;<br />
&gt; IDEs would be in the same spot, they can't tell you that whether or not your<br />
&gt; file is missing the opening tags without looking into your php.ini/apache<br />
&gt; vhost/.htaccess config.<br />
&gt; it can be either fine or a bug, depending on the value of template_mode<br />
<br />
I think you have missed RFC spec.<br />
Even when template_mode=off, &quot;&lt;?php&quot; at the beginning of script file is<br />
allowed for compatibility.<br />
<br />
&gt; as Stas pointed out, if you migrate your codebase which depends on<br />
&gt; template_mode = Off, and you forgot to change the default php.ini (yeah, you<br />
&gt; should notice this before going live, but we are talking about the people<br />
&gt; having LFI and other vulns...) then your files will be served by your<br />
&gt; webserver as is. which itself can compromise your system.<br />
<br />
I think this could be verified easily by find and grep or IDE search.<br />
Modern script would not have needless PHP files under docroot also.<br />
<br />
&gt; &quot;With this RFC, the only allowed PHP tag under non embed mode is ”&lt;?php”.&quot;<br />
<br />
No. &lt;?php &lt;? &lt;% and others are allowed.<br />
<br />
Anyone wants &lt;script language=&quot;php&quot;&gt;?<br />
<br />
&gt; oh, isn't that contradicting &quot;This RFC proposes removal of PHP tags (&lt;?php<br />
&gt; and so forth) from the PHP script by php.ini or CLI option flags.&quot; and &quot;Not<br />
&gt; a few programmers may once have been bothered to put a PHP tag at the top of<br />
&gt; every PHP script that only contains classes and functions. In short, PHP<br />
&gt; tags are just ancient.&quot;<br />
&gt; although it would lessen the BC/incompatibility problems mentioned above.<br />
<br />
Thanks for catching it.<br />
It was written for April Fool day by Moriyoshi.<br />
I should have edited his joke :)<br />
<br />
&gt;<br />
&gt; In general I'm -1 on this RFC, I think that the people who are vulnerable<br />
&gt; wouldn't use it, and there are better alternatives for the described<br />
&gt; problems than the introduction of template_mode.<br />
<br />
Are there? I should have missed.<br />
What is the better alternative?<br />
<br />
&gt; this would add an additional level of complexity and would make it harder to<br />
&gt; write portable code.<br />
<br />
This is misunderstanding.<br />
You might be felt by the part of April Fool's joke.<br />
I'll edit the part from now and please reconsider.<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 11:00:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476316#msg-476316</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476316#msg-476316</link>
            <description><![CDATA[ &gt;<br />
&gt;<br />
&gt; &quot;allow_url_include&quot;  and  &quot;template_mode&quot; is similar to me.<br />
&gt;<br />
&gt; allow_url_include: enable only when url include is needed.<br />
&gt; template_mode:    enable only when template mode is needed.<br />
&gt;<br />
&gt; allow_url_include prevents RFI which may result in critical security<br />
&gt; incident.<br />
&gt; template_mode prevents LFI which may result in critical security incident..<br />
&gt;<br />
&gt; Note: template_mode=off is script only mode. On is current behavior.<br />
&gt;<br />
&gt;<br />
I just glanced over the RFC.<br />
See my comments below:<br />
&quot;LFI/RFI is fatal security error. Currently, LFI prevention is upto<br />
programmers and framework authors/system admins do not have feasible way to<br />
prevent LFI&quot;<br />
what about open_basedir?<br />
<br />
&quot;Current PHP is weak to script injections compare to other languages such<br />
as Ruby/Perl/Phthon/Lua/etc.&quot;<br />
would be nice listing what does those languages do better in thise regard.<br />
AFAIK ruby allows you to include arbitrary files, and the rails security<br />
guides even mention the file upload vulnerability:<br />
<a href="http://guides.rubyonrails.org/security.html#executable-code-in-file-uploads" target="_blank"  rel="nofollow">http://guides.rubyonrails.org/security.html#executable-code-in-file-uploads</a><br />
perl also have require, Python has import, which is maybe a little bit<br />
harder to misuse, lua has both dofile and require.<br />
it would be nice explaining what do you mean by php being week compared to<br />
those languages.<br />
<br />
&quot;PHP script inclusion detection may be done for data files. However, it's<br />
not a simple task.&quot;<br />
as I mentioned before, I don't think that it is the good way to try to<br />
detect the injected code in the data files:<br />
one should know beforehand that whether is the uploaded file is meant to be<br />
a data file or a script file, and act accordingly.<br />
<br />
&quot;Almost all applications are not checking these and it would be impossible<br />
to make developers do a proper validation.&quot;<br />
these kind of filtering techniques are error prone.<br />
<br />
&quot;Disabling embed(template) mode is simple solution for this issue.&quot;<br />
one can still upload valid embed files and if the LFI is present, execute<br />
those.<br />
<br />
so your solution would only improve this problem, if an LFI vulnerability<br />
is present or the uploaded files are publically accessible and not excluded<br />
from the execution and the file uploads otherwise properly type validated<br />
and the developer choses to be compatible with the template_mode off and<br />
disables it(as the default would be on).<br />
I think that it would be really hard to adopt. Framework developers are<br />
trying to support the widest audience, and supporting both template_mode On<br />
and Off will be a major PITA imo.<br />
and until they do, the average developer can't be expected to make his<br />
choice of framework compatible with template_mode off, so he/she won't use<br />
it.<br />
I think it would require far less work to find and fix the LFIs and<br />
properly configure the webserver than rewriting your whole application<br />
(including your libraries).<br />
<br />
IDEs would be in the same spot, they can't tell you that whether or not<br />
your file is missing the opening tags without looking into your<br />
php.ini/apache vhost/.htaccess config.<br />
it can be either fine or a bug, depending on the value of template_mode<br />
<br />
as Stas pointed out, if you migrate your codebase which depends on<br />
template_mode = Off, and you forgot to change the default php.ini (yeah,<br />
you should notice this before going live, but we are talking about the<br />
people having LFI and other vulns...) then your files will be served by<br />
your webserver as is. which itself can compromise your system.<br />
<br />
&quot;With this RFC, the only allowed PHP tag under non embed mode is ”&lt;?php”.&quot;<br />
oh, isn't that contradicting &quot;This RFC proposes removal of PHP tags (&lt;?php<br />
and so forth) from the PHP script by php.ini or CLI option flags.&quot; and &quot;Not<br />
a few programmers may once have been bothered to put a PHP tag at the top<br />
of every PHP script that only contains classes and functions. In short, PHP<br />
tags are just ancient.&quot;<br />
although it would lessen the BC/incompatibility problems mentioned above.<br />
<br />
In general I'm -1 on this RFC, I think that the people who are vulnerable<br />
wouldn't use it, and there are better alternatives for the described<br />
problems than the introduction of template_mode.<br />
this would add an additional level of complexity and would make it harder<br />
to write portable code.<br />
<br />
-- <br />
Ferenc Kovács<br />
@Tyr43l - <a href="http://tyrael.hu" target="_blank"  rel="nofollow">http://tyrael.hu</a>]]></description>
            <dc:creator>Ferenc Kovacs</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 10:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476295#msg-476295</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476295#msg-476295</link>
            <description><![CDATA[ On 10 April 2012 15:30, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt; &quot;allow_url_include&quot;  and  &quot;template_mode&quot; is similar to me.<br />
&gt;<br />
&gt; allow_url_include: enable only when url include is needed.<br />
&gt; template_mode:    enable only when template mode is needed.<br />
&gt;<br />
&gt; allow_url_include prevents RFI which may result in critical security incident.<br />
&gt; template_mode prevents LFI which may result in critical security incident..<br />
&gt;<br />
&gt; Note: template_mode=off is script only mode. On is current behavior.<br />
<br />
Honestly, I'd consider allow_url_include a mistake, and would hate to<br />
see additional configuration dependent behaviour enter PHP, as I've<br />
said before.<br />
<br />
Adam<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Adam Harvey</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 10:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476280#msg-476280</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476280#msg-476280</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Kris Craig &lt;kris.craig@gmail.com&gt;:<br />
&gt;<br />
&gt;<br />
&gt; On Mon, Apr 9, 2012 at 10:35 PM, Luke Scott &lt;luke@cywh.com&gt; wrote:<br />
&gt;&gt;<br />
&gt;&gt; On Apr 9, 2012, at 10:03 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt;&gt;<br />
&gt;&gt; &gt; I strongly discourage settingallow_url_include=on, too.<br />
&gt;&gt;<br />
&gt;&gt; Good.<br />
&gt;&gt;<br />
&gt;&gt; &gt; Enabling it only when it is needed is okay.<br />
&gt;&gt;<br />
&gt;&gt; No it's not. There is no reason to do so other than backwards<br />
&gt;&gt; compatibility for very old code.<br />
&gt;&gt;<br />
&gt;&gt; &gt; I think you are concerned about security,<br />
&gt;&gt;<br />
&gt;&gt; Absolutely.<br />
&gt;&gt;<br />
&gt;&gt; &gt; so you could agree to have<br />
&gt;&gt; &gt; option for disabling embedded mode by option,  couldn't you?<br />
&gt;&gt;<br />
&gt;&gt; Sure it can be an option. But it can't be the default, at least right<br />
&gt;&gt; away. It's unreasonable. I would prefer an environmental variable to<br />
&gt;&gt; choose the mode though. I'm not opposed to a php.ini option, but some<br />
&gt;&gt; people are<br />
&gt;&gt;<br />
&gt;&gt; (If by embedded mode you mean template mode, and non-embedded mode as<br />
&gt;&gt; &quot;pure code mode&quot;).<br />
&gt;&gt;<br />
&gt;&gt; I still fail to see what this has to do with allow_url_include.<br />
&gt;&gt;<br />
&gt;&gt; &gt; Letting programmers decide what  to do<br />
&gt;&gt;<br />
&gt;&gt; Not in all cases.<br />
&gt;&gt;<br />
&gt;&gt; &gt; Programming languages should give freedom to write suicide code<br />
&gt;&gt; &gt; more or less.<br />
&gt;&gt;<br />
&gt;&gt; No, it shouldn't.<br />
&gt;&gt;<br />
&gt;&gt; All that you've said comes down to this:<br />
&gt;&gt;<br />
&gt;&gt; Don't write bad code. Configure your web server properly.<br />
&gt;&gt;<br />
&gt;&gt; The RFC isn't meant to address these issues, and quite frankly it<br />
&gt;&gt; isn't a core PHP issue. It's no different than any language with an<br />
&gt;&gt; eval() statement.<br />
&gt;&gt;<br />
&gt;&gt; Keep in mind an RFC isn't gospel. And it's still being drafted. We<br />
&gt;&gt; need to give Tom a chance to finish it.<br />
&gt;&gt;<br />
&gt;&gt; Luke<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt;&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;&gt;<br />
&gt;<br />
&gt; I feel obliged to point out that both sides of this argument have been<br />
&gt; represented eloquently and fully IMHO.  It now seems to have reached the<br />
&gt; point where all substantive arguments have been said and thus are now merely<br />
&gt; being repeated.  The last few messages back-and-forth could, at least one<br />
&gt; some level, be summarized simply as, &quot;Yes it is!&quot; and &quot;No it isn't!&quot;<br />
&gt;<br />
&gt; There's clearly a fundamental disagreement exposed here as to the role a<br />
&gt; programming language should play pertaining to the prevention of vulnerable<br />
&gt; code and whether the burden lies with the language or the programmer to<br />
&gt; assume responsibility for this.  My guess would be that it falls somewhere<br />
&gt; in the middle, though I really haven't given it much thought to be honest..<br />
<br />
I believe there is misunderstanding.<br />
allow_url_include and templat_mode is very similar to me, yet<br />
there is not an agreement.<br />
<br />
&gt;<br />
&gt; I'd like to suggest that a new thread be created for this debate, since it<br />
&gt; does seem to be sufficiently divergent from the original topic posted by<br />
&gt; Tom.  I would also be interested to hear why you believe it should or should<br />
&gt; not be the role of the language to prevent exploitable code and to what<br />
&gt; degree.  Both sides have stated quite authoritatively that it is one or the<br />
&gt; other, but what I'd like to see are some more in-depth arguments to back-up<br />
&gt; those assertions.  From a strictly academic standpoint, I think this<br />
&gt; argument poses an interesting opportunity to explore this philosophical<br />
&gt; divide in detail.<br />
&gt;<br />
&gt;<br />
&gt; But regardless, let's at least move it to a separate topic so Tom can argue<br />
&gt; the case for his RFC without too much distraction.  =)<br />
<br />
These RFC is similar, but it's different.<br />
That why I separated the RFC.<br />
<br />
Why shouldn't thread. I'll post new one.<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<a href="mailto:&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;">&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;</a><br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 09:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476279#msg-476279</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476279#msg-476279</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Luke Scott &lt;luke@cywh.com&gt;:<br />
&gt; On Apr 9, 2012, at 10:03 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt;<br />
&gt;&gt; I strongly discourage settingallow_url_include=on, too.<br />
&gt;<br />
&gt; Good.<br />
&gt;<br />
&gt;&gt; Enabling it only when it is needed is okay.<br />
&gt;<br />
&gt; No it's not. There is no reason to do so other than backwards<br />
&gt; compatibility for very old code.<br />
&gt;<br />
&gt;&gt; I think you are concerned about security,<br />
&gt;<br />
&gt; Absolutely.<br />
&gt;<br />
&gt;&gt; so you could agree to have<br />
&gt;&gt; option for disabling embedded mode by option,  couldn't you?<br />
&gt;<br />
&gt; Sure it can be an option. But it can't be the default, at least right<br />
&gt; away. It's unreasonable. I would prefer an environmental variable to<br />
&gt; choose the mode though. I'm not opposed to a php.ini option, but some<br />
&gt; people are<br />
&gt;<br />
&gt; (If by embedded mode you mean template mode, and non-embedded mode as<br />
&gt; &quot;pure code mode&quot;).<br />
&gt;<br />
&gt; I still fail to see what this has to do with allow_url_include.<br />
<br />
&quot;allow_url_include&quot;  and  &quot;template_mode&quot; is similar to me.<br />
<br />
allow_url_include: enable only when url include is needed.<br />
template_mode:    enable only when template mode is needed.<br />
<br />
allow_url_include prevents RFI which may result in critical security incident.<br />
template_mode prevents LFI which may result in critical security incident.<br />
<br />
Note: template_mode=off is script only mode. On is current behavior.<br />
<br />
&gt;<br />
&gt;&gt; Letting programmers decide what  to do<br />
&gt;<br />
&gt; Not in all cases.<br />
&gt;<br />
&gt;&gt; Programming languages should give freedom to write suicide code<br />
&gt;&gt; more or less.<br />
&gt;<br />
&gt; No, it shouldn't.<br />
&gt;<br />
&gt; All that you've said comes down to this:<br />
&gt;<br />
&gt; Don't write bad code. Configure your web server properly.<br />
<br />
Wouldn't it be the same for allow_url_include?<br />
One could argue the same way for it.<br />
<br />
&gt; The RFC isn't meant to address these issues, and quite frankly it<br />
&gt; isn't a core PHP issue. It's no different than any language with an<br />
&gt; eval() statement.<br />
<br />
I suppose you have missed SQL injection and LFI vulnerability<br />
discussion. LFI's true risk is misunderstood by many people,<br />
just like session adoption risk. (which I'm willing to fix it also)<br />
<br />
Note that SQL injection and LFI are common vulnerability<br />
for PHP applications.<br />
<br />
Please read the RFC how SQL injection is related to LFI.<br />
<br />
<a href="https://wiki.php.net/rfc/nophptags" target="_blank"  rel="nofollow">https://wiki.php.net/rfc/nophptags</a><br />
<br />
template_mode is much like allow_url_include.<br />
If user follow guideline, it eliminates LFI risk, just like RFI.<br />
<br />
&gt;<br />
&gt; Keep in mind an RFC isn't gospel. And it's still being drafted. We<br />
&gt; need to give Tom a chance to finish it.<br />
<br />
I'm the one listed it under discussion :)<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<a href="mailto:&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;">&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;</a><br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 09:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476270#msg-476270</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476270#msg-476270</link>
            <description><![CDATA[ On Mon, Apr 9, 2012 at 10:35 PM, Luke Scott &lt;luke@cywh.com&gt; wrote:<br />
<br />
&gt; On Apr 9, 2012, at 10:03 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt;<br />
&gt; &gt; I strongly discourage settingallow_url_include=on, too.<br />
&gt;<br />
&gt; Good.<br />
&gt;<br />
&gt; &gt; Enabling it only when it is needed is okay.<br />
&gt;<br />
&gt; No it's not. There is no reason to do so other than backwards<br />
&gt; compatibility for very old code.<br />
&gt;<br />
&gt; &gt; I think you are concerned about security,<br />
&gt;<br />
&gt; Absolutely.<br />
&gt;<br />
&gt; &gt; so you could agree to have<br />
&gt; &gt; option for disabling embedded mode by option,  couldn't you?<br />
&gt;<br />
&gt; Sure it can be an option. But it can't be the default, at least right<br />
&gt; away. It's unreasonable. I would prefer an environmental variable to<br />
&gt; choose the mode though. I'm not opposed to a php.ini option, but some<br />
&gt; people are<br />
&gt;<br />
&gt; (If by embedded mode you mean template mode, and non-embedded mode as<br />
&gt; &quot;pure code mode&quot;).<br />
&gt;<br />
&gt; I still fail to see what this has to do with allow_url_include.<br />
&gt;<br />
&gt; &gt; Letting programmers decide what  to do<br />
&gt;<br />
&gt; Not in all cases.<br />
&gt;<br />
&gt; &gt; Programming languages should give freedom to write suicide code<br />
&gt; &gt; more or less.<br />
&gt;<br />
&gt; No, it shouldn't.<br />
&gt;<br />
&gt; All that you've said comes down to this:<br />
&gt;<br />
&gt; Don't write bad code. Configure your web server properly.<br />
&gt;<br />
&gt; The RFC isn't meant to address these issues, and quite frankly it<br />
&gt; isn't a core PHP issue. It's no different than any language with an<br />
&gt; eval() statement.<br />
&gt;<br />
&gt; Keep in mind an RFC isn't gospel. And it's still being drafted. We<br />
&gt; need to give Tom a chance to finish it.<br />
&gt;<br />
&gt; Luke<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
&gt;<br />
I feel obliged to point out that both sides of this argument have been<br />
represented eloquently and fully IMHO.  It now seems to have reached the<br />
point where all substantive arguments have been said and thus are now<br />
merely being repeated.  The last few messages back-and-forth could, at<br />
least one some level, be summarized simply as, &quot;Yes it is!&quot; and &quot;No it<br />
isn't!&quot;<br />
<br />
There's clearly a fundamental disagreement exposed here as to the role a<br />
programming language should play pertaining to the prevention of vulnerable<br />
code and whether the burden lies with the language or the programmer to<br />
assume responsibility for this.  My guess would be that it falls somewhere<br />
in the middle, though I really haven't given it much thought to be honest.<br />
<br />
I'd like to suggest that a new thread be created for this debate, since it<br />
does seem to be sufficiently divergent from the original topic posted by<br />
Tom.  I would also be interested to hear why you believe it should or<br />
should not be the role of the language to prevent exploitable code and to<br />
what degree.  Both sides have stated quite authoritatively that it is one<br />
or the other, but what I'd like to see are some more in-depth arguments to<br />
back-up those assertions.  From a strictly academic standpoint, I think<br />
this argument poses an interesting opportunity to explore this<br />
philosophical divide in detail.<br />
<br />
<br />
But regardless, let's at least move it to a separate topic so Tom can argue<br />
the case for his RFC without too much distraction.  =)<br />
<br />
--Kris]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 09:00:06 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476241#msg-476241</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476241#msg-476241</link>
            <description><![CDATA[ On Apr 9, 2012, at 10:03 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
<br />
&gt; I strongly discourage settingallow_url_include=on, too.<br />
<br />
Good.<br />
<br />
&gt; Enabling it only when it is needed is okay.<br />
<br />
No it's not. There is no reason to do so other than backwards<br />
compatibility for very old code.<br />
<br />
&gt; I think you are concerned about security,<br />
<br />
Absolutely.<br />
<br />
&gt; so you could agree to have<br />
&gt; option for disabling embedded mode by option,  couldn't you?<br />
<br />
Sure it can be an option. But it can't be the default, at least right<br />
away. It's unreasonable. I would prefer an environmental variable to<br />
choose the mode though. I'm not opposed to a php.ini option, but some<br />
people are<br />
<br />
(If by embedded mode you mean template mode, and non-embedded mode as<br />
&quot;pure code mode&quot;).<br />
<br />
I still fail to see what this has to do with allow_url_include.<br />
<br />
&gt; Letting programmers decide what  to do<br />
<br />
Not in all cases.<br />
<br />
&gt; Programming languages should give freedom to write suicide code<br />
&gt; more or less.<br />
<br />
No, it shouldn't.<br />
<br />
All that you've said comes down to this:<br />
<br />
Don't write bad code. Configure your web server properly.<br />
<br />
The RFC isn't meant to address these issues, and quite frankly it<br />
isn't a core PHP issue. It's no different than any language with an<br />
eval() statement.<br />
<br />
Keep in mind an RFC isn't gospel. And it's still being drafted. We<br />
need to give Tom a chance to finish it.<br />
<br />
Luke<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Luke Scott</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 07:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476233#msg-476233</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476233#msg-476233</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Luke Scott &lt;luke@cywh.com&gt;:<br />
&gt; On Apr 9, 2012, at 9:08 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt;<br />
&gt;&gt;&gt; I would actually suggest that require/include stop supporting remote<br />
&gt;&gt;&gt; files all together. But that can be a different RFC.<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; This &quot;security problem&quot; isn't a problem with common sense.<br />
&gt;&gt;<br />
&gt;&gt; Requiring/Including remote file is not bad, just like embedded mode<br />
&gt;&gt; of PHP is not bad.<br />
&gt;<br />
&gt; You can fetch a remote file with curl, socket functions, he'll even<br />
&gt; file_get_contents. Point is you shouldn't be using require/include for<br />
&gt; including remote files. It's not the purpose of these functions, and<br />
&gt; even though &quot;you can&quot; it doesn't mean you should and it's highly<br />
&gt; discouraged.<br />
<br />
I strongly discourage setting allow_url_include=on, too.<br />
Enabling it only when it is needed is okay.<br />
<br />
I think you are concerned about security, so you could agree to have<br />
option for disabling embedded mode by option,  couldn't you?<br />
<br />
&gt;<br />
&gt; It's not a core PHP problem. It's programming problem.<br />
&gt;<br />
&gt; Where I work we forbid certain things like this for good reason. We<br />
&gt; also have a code review process. All code is checked by another<br />
&gt; developer before it gets commited. Even my code, and I'm a manager.<br />
&gt; This should be done at the very least. Some companies do this and then<br />
&gt; have a third party audit the code on top of it.<br />
<br />
Letting programmers decide what  to do is good as well as giving secure<br />
default and secure standards.<br />
<br />
PHP is programming language anyway.<br />
<br />
Programming languages should give freedom to write suicide code<br />
more or less. Otherwise, it will limit creative work of programmers.<br />
Not limiting or prohibiting some feature, &quot;Setting reasonable default<br />
behavior&quot; is what PHP project should do. IMO.<br />
<br />
&gt;&gt; They are bad for security if they are enabled by default or mandatory.<br />
&gt;<br />
&gt; Again nothing has changed with this RFC.<br />
<br />
That's the problem.<br />
If PHP is going to drop mandatory embedding, PHP should better to<br />
remove LFI mess due to mandatory embed mode. IMHO<br />
<br />
Mandatory embedded mode is insecure than optional one.<br />
If other scripting languages have mandatory embed mode, then it may<br />
stay as it is now. However, PHP is the only one that is too weak to LFI.<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<a href="mailto:&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;">&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;</a><br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 07:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476228#msg-476228</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476228#msg-476228</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Chris Stockton &lt;chrisstocktonaz@gmail.com&gt;:<br />
&gt;&gt; People does this should not security issues, though.<br />
<br />
I should have written<br />
<br />
People does this should know security issues, though.<br />
<br />
then you might make sense with it.<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<a href="mailto:&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;">&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;</a><br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 06:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476227#msg-476227</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476227#msg-476227</link>
            <description><![CDATA[ On Apr 9, 2012, at 9:08 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
<br />
&gt;&gt; I would actually suggest that require/include stop supporting remote<br />
&gt;&gt; files all together. But that can be a different RFC.<br />
&gt;&gt;<br />
&gt;&gt; This &quot;security problem&quot; isn't a problem with common sense.<br />
&gt;<br />
&gt; Requiring/Including remote file is not bad, just like embedded mode<br />
&gt; of PHP is not bad.<br />
<br />
You can fetch a remote file with curl, socket functions, he'll even<br />
file_get_contents. Point is you shouldn't be using require/include for<br />
including remote files. It's not the purpose of these functions, and<br />
even though &quot;you can&quot; it doesn't mean you should and it's highly<br />
discouraged.<br />
<br />
It's not a core PHP problem. It's programming problem.<br />
<br />
Where I work we forbid certain things like this for good reason. We<br />
also have a code review process. All code is checked by another<br />
developer before it gets commited. Even my code, and I'm a manager.<br />
This should be done at the very least. Some companies do this and then<br />
have a third party audit the code on top of it.<br />
<br />
&gt; They are bad for security if they are enabled by default or mandatory.<br />
<br />
Again nothing has changed with this RFC.<br />
<br />
Luke<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Luke Scott</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 06:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476225#msg-476225</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476225#msg-476225</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Chris Stockton &lt;chrisstocktonaz@gmail.com&gt;:<br />
&gt; Hello,<br />
&gt;<br />
&gt; On Mon, Apr 9, 2012 at 8:25 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt;&gt; Hi,<br />
&gt;&gt;<br />
&gt;&gt; There is valid usage for allow_url_include=on.<br />
&gt;&gt;<br />
&gt;&gt; For instance, if both server and client is PHP, we could use var_export()<br />
&gt;&gt; to receive messages.<br />
&gt;&gt;<br />
&gt;&gt; Client<br />
&gt;&gt; ----<br />
&gt;&gt; &lt;?php<br />
&gt;&gt; include('http://server/send_my_data.php');<br />
&gt;&gt; ?&gt;<br />
&gt;&gt; ----<br />
&gt;&gt;<br />
&gt;&gt; Server: /send_my_data.php<br />
&gt;&gt; ----<br />
&gt;&gt; &lt;?php<br />
&gt;&gt; echo &quot;$response = &quot;;<br />
&gt;&gt; var_export($some_useful_data);<br />
&gt;&gt; ?&gt;<br />
&gt;&gt; ----<br />
&gt;&gt;<br />
&gt;&gt; This is the most efficient way to exchange data between PHP servers.<br />
&gt;&gt; People does this should not security issues, though.<br />
&gt;&gt;<br />
&gt;&gt; BTW, do you remember allow_rul_fopen was changed to INI_SYSTEM?<br />
&gt;&gt; This should be INI_ALL as well as allow_rul_include, IMO.<br />
&gt;&gt;<br />
&gt;&gt; Regards,<br />
&gt;&gt;<br />
&gt;<br />
&gt; Perhaps you could bring your discussion to the php general mailing<br />
&gt; list as opposed to the internals? You might find a good bit of<br />
&gt; reasonable feedback and information for handling user input there, in<br />
&gt; the exact scenarios you mentioned.<br />
<br />
I guess you have never benchmarked various methods.<br />
I haven't done it for a long time, so the result may differ<br />
though. If you find interesting result, please let us know.<br />
<br />
Anyway, just like PHP being a embedded language, this method is<br />
perfectly valid. It has been there for a long time, too. IIRC,<br />
var_export() was implemented by Derick during PHP 4.x, so<br />
it's rather new(?) feature compare to embedded lang, though.<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<a href="mailto:&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;">&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;</a><br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 06:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476224#msg-476224</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476224#msg-476224</link>
            <description><![CDATA[ Hello,<br />
<br />
On Mon, Apr 9, 2012 at 8:25 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt; Hi,<br />
&gt;<br />
&gt; There is valid usage for allow_url_include=on.<br />
&gt;<br />
&gt; For instance, if both server and client is PHP, we could use var_export()<br />
&gt; to receive messages.<br />
&gt;<br />
&gt; Client<br />
&gt; ----<br />
&gt; &lt;?php<br />
&gt; include('http://server/send_my_data.php');<br />
&gt; ?&gt;<br />
&gt; ----<br />
&gt;<br />
&gt; Server: /send_my_data.php<br />
&gt; ----<br />
&gt; &lt;?php<br />
&gt; echo &quot;$response = &quot;;<br />
&gt; var_export($some_useful_data);<br />
&gt; ?&gt;<br />
&gt; ----<br />
&gt;<br />
&gt; This is the most efficient way to exchange data between PHP servers.<br />
&gt; People does this should not security issues, though.<br />
&gt;<br />
&gt; BTW, do you remember allow_rul_fopen was changed to INI_SYSTEM?<br />
&gt; This should be INI_ALL as well as allow_rul_include, IMO.<br />
&gt;<br />
&gt; Regards,<br />
&gt;<br />
<br />
Perhaps you could bring your discussion to the php general mailing<br />
list as opposed to the internals? You might find a good bit of<br />
reasonable feedback and information for handling user input there, in<br />
the exact scenarios you mentioned.<br />
<br />
-Chris<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Chris Stockton</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 06:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476223#msg-476223</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476223#msg-476223</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Luke Scott &lt;luke@cywh.com&gt;:<br />
&gt;&gt; It's easy to say &quot;write correct code. don't write stupid code&quot;, but<br />
&gt;&gt; we cannot enforce it in real world.<br />
&gt;&gt;<br />
&gt;&gt; I'm concerning both arbitrarily script execution and arbitrarily<br />
&gt;&gt; information disclosure. Good example is  LFI and SQL injection<br />
&gt;&gt; attack.<br />
&gt;<br />
&gt; Uh yeah there is. I won't employ someone who insists on writing code<br />
&gt; like this. I dont know anyone who will. I also wont use libraries that<br />
&gt; have code like this. Not only is it insecure but an improper use of<br />
&gt; these constructs/functions.<br />
<br />
Attackers are supposed to abuse features.<br />
Writing data into a file is RDBMS feature.<br />
Including file is PHP feature.<br />
<br />
Combined features could give great freedom to attackers stealing<br />
data and/or executing scripts.<br />
<br />
What we should consider is &quot;proper protections&quot;.<br />
<br />
&gt; All this has nothing to do with Tom's RFC. It has nothing to do with<br />
&gt; having a &lt;?php tag or not.<br />
<br />
<a href="https://wiki.php.net/rfc/source_files_without_opening_tag" target="_blank"  rel="nofollow">https://wiki.php.net/rfc/source_files_without_opening_tag</a><br />
<br />
The RFC states &quot;This RFC proposes a way to support source code<br />
files without &lt;?php at the top.&quot;<br />
<br />
It has almost nothing to do LFI protection, though.<br />
<br />
&gt; I would actually suggest that require/include stop supporting remote<br />
&gt; files all together. But that can be a different RFC.<br />
&gt;<br />
&gt; This &quot;security problem&quot; isn't a problem with common sense.<br />
<br />
Requiring/Including remote file is not bad, just like embedded mode<br />
of PHP is not bad.<br />
<br />
They are bad for security if they are enabled by default or mandatory.<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 06:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476217#msg-476217</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476217#msg-476217</link>
            <description><![CDATA[ &gt; It's easy to say &quot;write correct code. don't write stupid code&quot;, but<br />
&gt; we cannot enforce it in real world.<br />
&gt;<br />
&gt; I'm concerning both arbitrarily script execution and arbitrarily<br />
&gt; information disclosure. Good example is  LFI and SQL injection<br />
&gt; attack.<br />
<br />
Uh yeah there is. I won't employ someone who insists on writing code<br />
like this. I dont know anyone who will. I also wont use libraries that<br />
have code like this. Not only is it insecure but an improper use of<br />
these constructs/functions.<br />
<br />
All this has nothing to do with Tom's RFC. It has nothing to do with<br />
having a &lt;?php tag or not.<br />
<br />
I would actually suggest that require/include stop supporting remote<br />
files all together. But that can be a different RFC.<br />
<br />
This &quot;security problem&quot; isn't a problem with common sense.<br />
<br />
Luke<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Luke Scott</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 05:50:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476212#msg-476212</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476212#msg-476212</link>
            <description><![CDATA[ On Apr 9, 2012, at 8:26 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
<br />
&gt; Hi,<br />
&gt;<br />
&gt; 2012/4/10 Luke Scott &lt;luke@cywh.com&gt;:<br />
&gt;&gt; On Apr 9, 2012, at 7:50 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt;&gt;<br />
&gt;&gt;&gt; Please don't repeat mistakes for allow_url_include or allow_url_include.<br />
&gt;&gt;&gt; If admin would like to enforce programmer not to change php.ini.<br />
&gt;&gt;&gt; They should use Apache httpd and admin_flag/admin_value.<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; Programmers should have as much control as possible to be<br />
&gt;&gt;&gt; creative. Optional embedded mode is one of them. There are<br />
&gt;&gt;&gt; too many thing that programmers should worry. If it can be turned<br />
&gt;&gt;&gt; off, they are free from it.<br />
&gt;&gt;<br />
&gt;&gt; I'm not sure we're talking about the same thing. I'm really confused<br />
&gt;&gt; about the objections.<br />
&gt;&gt;<br />
&gt;&gt; The ini options you mention are not mistakes. You should never be<br />
&gt;&gt; using include/require for anything other than including local PHP<br />
&gt;&gt; files. These constructs should have never supported remote files. That<br />
&gt;<br />
&gt; There is valid usage for allow_url_include=on.<br />
&gt;<br />
&gt; For instance, if both server and client is PHP, we could use var_export()<br />
&gt; to receive messages.<br />
&gt;<br />
&gt; Client<br />
&gt; ----<br />
&gt; &lt;?php<br />
&gt; include('http://server/send_my_data.php');<br />
&gt; ?&gt;<br />
&gt; ----<br />
&gt;<br />
&gt; Server: /send_my_data.php<br />
&gt; ----<br />
&gt; &lt;?php<br />
&gt; echo &quot;$response = &quot;;<br />
&gt; var_export($some_useful_data);<br />
&gt; ?&gt;<br />
&gt; ----<br />
<br />
You should NEVER do this. There are much better ways of communicating<br />
between servers.<br />
<br />
Luke<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Luke Scott</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 05:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476209#msg-476209</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476209#msg-476209</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Luke Scott &lt;luke@cywh.com&gt;:<br />
&gt; On Apr 9, 2012, at 7:50 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt;<br />
&gt;&gt; Please don't repeat mistakes for allow_url_include or allow_url_include.<br />
&gt;&gt; If admin would like to enforce programmer not to change php.ini.<br />
&gt;&gt; They should use Apache httpd and admin_flag/admin_value.<br />
&gt;&gt;<br />
&gt;&gt; Programmers should have as much control as possible to be<br />
&gt;&gt; creative. Optional embedded mode is one of them. There are<br />
&gt;&gt; too many thing that programmers should worry. If it can be turned<br />
&gt;&gt; off, they are free from it.<br />
&gt;<br />
&gt; I'm not sure we're talking about the same thing. I'm really confused<br />
&gt; about the objections.<br />
&gt;<br />
&gt; The ini options you mention are not mistakes. You should never be<br />
&gt; using include/require for anything other than including local PHP<br />
&gt; files. These constructs should have never supported remote files. That<br />
<br />
There is valid usage for allow_url_include=on.<br />
<br />
For instance, if both server and client is PHP, we could use var_export()<br />
to receive messages.<br />
<br />
Client<br />
----<br />
&lt;?php<br />
include('http://server/send_my_data.php');<br />
?&gt;<br />
----<br />
<br />
Server: /send_my_data.php<br />
----<br />
&lt;?php<br />
echo &quot;$response = &quot;;<br />
var_export($some_useful_data);<br />
?&gt;<br />
----<br />
<br />
This is the most efficient way to exchange data between PHP servers.<br />
People does this should not security issues, though.<br />
<br />
BTW, do you remember allow_rul_fopen was changed to INI_SYSTEM?<br />
This should be INI_ALL as well as allow_rul_include, IMO.<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<a href="mailto:&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;">&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;</a><br />
<br />
&gt; was the mistake. The same goes for functions like file_get_contents -<br />
&gt; there are more appropriate ways of getting remote content.<br />
&gt; file_get_contents isn't nearly as bad though.<br />
&gt;<br />
&gt; ... But any of the above has nothing to do with this RFC.<br />
&gt;<br />
&gt; Luke<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 05:30:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476205#msg-476205</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476205#msg-476205</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Stas Malyshev &lt;smalyshev@sugarcrm.com&gt;:<br />
&gt; Hi!<br />
&gt;<br />
&gt;&gt; LFI risk is unique to PHP. The cause of risk is mandatory embedded script.<br />
&gt;<br />
&gt; No it's not. If you write Python code that loads code from random file<br />
&gt; and evaluates it, it will be &quot;vulnerability in Python&quot;. If you write in<br />
&gt; in Bash, it would be &quot;vulnerability in bash&quot;. If you write it in C, it<br />
&gt; will be &quot;vulnerability in C&quot;. I don't see anything unique to PHP here.<br />
<br />
Thank you for pointing out the incorrect statement.<br />
I know the condition to allow LFI for Perl/Ruby, also.<br />
LFI with PHP is just too easy :)<br />
<br />
As I wrote in the RFC, PHP would be better as safe as other major<br />
languages. Better means it is not a mandatory.<br />
<br />
Regards,<br />
<br />
--<br />
Yasuo Ohgaki<br />
<a href="mailto:&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;">&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;</a><br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 05:20:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476203#msg-476203</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476203#msg-476203</link>
            <description><![CDATA[ Hi,<br />
<br />
2012/4/10 Luke Scott &lt;luke@cywh.com&gt;:<br />
&gt; On Apr 9, 2012, at 7:44 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
&gt;<br />
&gt;&gt; Hi,<br />
&gt;&gt;<br />
&gt;&gt; 2012/4/10 Luke Scott &lt;luke@cywh.com&gt;:<br />
&gt;&gt;&gt;&gt;&gt;&gt; That said, allowing the skipping of an initial &lt;?php tag at the top of<br />
&gt;&gt;&gt;&gt;&gt;&gt; the file probably wouldn't be a big deal to implement in code mode.<br />
&gt;&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt;&gt; OK. If you can agree to this then I'm good. Perhaps only allow white space<br />
&gt;&gt;&gt;&gt;&gt; before it (which is ignored - everything else throws a parse error)?<br />
&gt;&gt;&gt;&gt;<br />
&gt;&gt;&gt;&gt; Great, that sounds doable. (This would be *allowing* a leading &lt;?php,<br />
&gt;&gt;&gt;&gt; not *requiring* one.<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; Great! Then it seems we both agree.<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; As far as the require/include statement, have we pretty much settled<br />
&gt;&gt;&gt; on something like this:<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; include &quot;/foo/bar.php&quot;, INC_CODE;<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; verses:<br />
&gt;&gt;&gt;<br />
&gt;&gt;&gt; include_path &quot;/foo/bar.php&quot;;<br />
&gt;&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; These syntax does not help removing LFI risk in existing code<br />
&gt;&gt; and allows novice to write suicide code.<br />
&gt;&gt;<br />
&gt;&gt; The only valid reason make mandatory embedded mode to<br />
&gt;&gt; non mandatory is security. IMHO.<br />
&gt;&gt;<br />
&gt;&gt; BTW, although I'll vote opposing voice to have include_path() or<br />
&gt;&gt; like,  include_path() should be include_script(), shouldn't it?<br />
&gt;<br />
&gt; I'm not sure I fully understand your concern. require/include<br />
&gt; shouldn't be used for anything other than local php files. User input<br />
&gt; should also not be placed there.<br />
&gt;<br />
&gt; What am I missing?<br />
<br />
It's easy to say &quot;write correct code. don't write stupid code&quot;, but<br />
we cannot enforce it in real world.<br />
<br />
I'm concerning both arbitrarily script execution and arbitrarily<br />
information disclosure. Good example is  LFI and SQL injection<br />
attack.<br />
<br />
<a href="https://wiki.php.net/rfc/nophptags" target="_blank"  rel="nofollow">https://wiki.php.net/rfc/nophptags</a><br />
<br />
I added example to make use of SQL injection for script execution<br />
today. It may also be used stealing any data in databases, too.<br />
SQL injection can be made much easier with LFI. i.e. Blind SQL is not<br />
needed with LFI.<br />
<br />
Regards,<br />
<br />
P.S. I'm not insisting programming languages should protect it from<br />
all of stupid codes. I'm insisting PHP should give freedom to users<br />
that controls embed mode for better security.<br />
<br />
--<br />
Yasuo Ohgaki<br />
<a href="mailto:&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;">&#121;&#111;&#104;&#103;&#97;&#107;&#105;&#64;&#111;&#104;&#103;&#97;&#107;&#105;&#46;&#110;&#101;&#116;</a><br />
<br />
&gt;<br />
&gt; Luke<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Yasuo Ohgaki</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 05:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476202#msg-476202</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476202#msg-476202</link>
            <description><![CDATA[ Hi!<br />
<br />
&gt; LFI risk is unique to PHP. The cause of risk is mandatory embedded script.<br />
<br />
No it's not. If you write Python code that loads code from random file<br />
and evaluates it, it will be &quot;vulnerability in Python&quot;. If you write in<br />
in Bash, it would be &quot;vulnerability in bash&quot;. If you write it in C, it<br />
will be &quot;vulnerability in C&quot;. I don't see anything unique to PHP here.<br />
-- <br />
Stanislav Malyshev, Software Architect<br />
SugarCRM: <a href="http://www.sugarcrm.com/" target="_blank"  rel="nofollow">http://www.sugarcrm.com/</a><br />
(408)454-6900 ext. 227<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Stas Malyshev</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 05:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,475424,476201#msg-476201</guid>
            <title>Re: [PHP-DEV] RFC: source files without opening tag</title>
            <link>http://www.serverphorums.com/read.php?7,475424,476201#msg-476201</link>
            <description><![CDATA[ On Apr 9, 2012, at 7:50 PM, Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt; wrote:<br />
<br />
&gt; Please don't repeat mistakes for allow_url_include or allow_url_include.<br />
&gt; If admin would like to enforce programmer not to change php.ini.<br />
&gt; They should use Apache httpd and admin_flag/admin_value.<br />
&gt;<br />
&gt; Programmers should have as much control as possible to be<br />
&gt; creative. Optional embedded mode is one of them. There are<br />
&gt; too many thing that programmers should worry. If it can be turned<br />
&gt; off, they are free from it.<br />
<br />
I'm not sure we're talking about the same thing. I'm really confused<br />
about the objections.<br />
<br />
The ini options you mention are not mistakes. You should never be<br />
using include/require for anything other than including local PHP<br />
files. These constructs should have never supported remote files. That<br />
was the mistake. The same goes for functions like file_get_contents -<br />
there are more appropriate ways of getting remote content.<br />
file_get_contents isn't nearly as bad though.<br />
<br />
.... But any of the above has nothing to do with this RFC.<br />
<br />
Luke<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Luke Scott</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 10 Apr 2012 05:10:02 +0200</pubDate>
        </item>
    </channel>
</rss>
