<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PHP-DEV] [off] PHP: a fractal of bad design</title>
        <description>Hi folks,

today I read this post, I think that some points are valid, follow the link for
you guys

http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

Adir Kuhn
ZCE - Zend Certified Engineer **PHP 5.3 #ZEND004035
PSMI - Professional Scrum Master I</description>
        <link>http://www.serverphorums.com/read.php?7,476594,476594#msg-476594</link>
        <lastBuildDate>Sat, 25 May 2013 10:10:39 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,492785#msg-492785</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,492785#msg-492785</link>
            <description><![CDATA[ Nothing's stopping you from using === for integer comparison or <br />
validating your integer string using either ctype_digit() or <br />
is_numeric() before comparing it. (The difference between these two <br />
functions is is_numeric() allows for decimal points)<br />
<br />
On 05/07/2012 09:25 PM, Raymond Irving wrote:<br />
&gt; I was very surprised when I came across the == issue sometime ago. IMO<br />
&gt; strings should be compared as strings. They should never be converted to<br />
&gt; integer.<br />
&gt;<br />
&gt;<br />
&gt; 1==&quot;1&quot;          // always convert the number value to a string and then<br />
&gt; compare it<br />
&gt; &quot;foo&quot; == 0    //  should return false<br />
&gt;<br />
&gt; &quot;123abc&quot; == &quot;123nth&quot; // compare as string. Do not convert to numeric values<br />
&gt;<br />
&gt; &quot;0&quot;==0     //  true<br />
&gt; 0==&quot;0.&quot;  // false<br />
&gt;<br />
&gt; PHP is great but if we can work together to remove the flaws, then we can<br />
&gt; make it even greater. We have to leave the past behind us and look at where<br />
&gt; we want PHP to be in the next 5 years<br />
&gt;<br />
&gt;<br />
&gt; Best regards,<br />
&gt;<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>Joe Gillotti</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 09 May 2012 10:22:54 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491864#msg-491864</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491864#msg-491864</link>
            <description><![CDATA[ &gt; At most, I'd remove the part that truncates numeric strings like<br />
&gt; &quot;123abc&quot; and always convert them to 0, because that's almost *never*<br />
&gt; an intended effect. <br />
<br />
I too find it hard to think of the situation in which data must be<br />
stored, even in a temporary form, as &quot;123abc&quot; but is meant to be<br />
equivalent to 123. But it obviously has happened a bunch after all<br />
these years.<br />
<br />
Maybe a non-accidental example is where &quot;123a&quot;, 123b&quot;, and &quot;123c&quot; are<br />
all expected to be juggled to 123 -- i.e. the code is purposely<br />
utilizing the PHP behavior in place of explicit truncation in order to<br />
group certain items together. I'm 99.999% sure I've never done this,<br />
but it would be devilishly hard to find the bugs that would come from<br />
changing this behavior. Enough that I could see it being a major event<br />
that tarnishes the release of PHP-dot-whatever-makes-this-change.<br />
<br />
I also want to point out, as I did the other month when this came up,<br />
that MySQL does autoconversion that is identical to this case [1], and<br />
with **MP pairings so absurdly common, it makes sense to keep this<br />
behavior in PHP for this reason alone.<br />
<br />
-- S.<br />
<br />
<br />
[1] SELECT '123abc' = 123 // true in MySQL (but not in all RDBMSes)<br />
<br />
<br />
<br />
<br />
<br />
&gt; One could argue that &quot;123&quot; == 123 is, however.<br />
<br />
<br />
&gt; On May 7, 2012, at 6:25 PM, Raymond Irving wrote:<br />
<br />
&gt;&gt; I was very surprised when I came across the == issue sometime ago. IMO<br />
&gt;&gt; strings should be compared as strings. They should never be converted to<br />
&gt;&gt; integer.<br />
&gt;&gt; <br />
&gt;&gt; <br />
&gt;&gt; 1==&quot;1&quot;          // always convert the number value to a string and then<br />
&gt;&gt; compare it<br />
&gt;&gt; &quot;foo&quot; == 0    //  should return false<br />
&gt;&gt; <br />
&gt;&gt; &quot;123abc&quot; == &quot;123nth&quot; // compare as string. Do not convert to numeric values<br />
&gt;&gt; <br />
&gt;&gt; &quot;0&quot;==0     //  true<br />
&gt;&gt; 0==&quot;0.&quot;  // false<br />
&gt;&gt; <br />
&gt;&gt; PHP is great but if we can work together to remove the flaws, then we can<br />
&gt;&gt; make it even greater. We have to leave the past behind us and look at where<br />
&gt;&gt; we want PHP to be in the next 5 years<br />
&gt;&gt; <br />
&gt;&gt; <br />
&gt;&gt; Best regards,<br />
<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>Sanford Whiteman</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 08 May 2012 07:20:03 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491795#msg-491795</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491795#msg-491795</link>
            <description><![CDATA[ While it's not the prettiest of side effects in php, I don't agree it should be &quot;fixed&quot;<br />
<br />
On top of a massive BC break, it's not as if the results are inconsistent. Learning php means learning how type juggling works. <br />
<br />
At most, I'd remove the part that truncates numeric strings like &quot;123abc&quot; and always convert them to 0, because that's almost *never* an intended effect. One could argue that &quot;123&quot; == 123 is, however.<br />
<br />
<br />
On May 7, 2012, at 6:25 PM, Raymond Irving wrote:<br />
<br />
&gt; I was very surprised when I came across the == issue sometime ago. IMO<br />
&gt; strings should be compared as strings. They should never be converted to<br />
&gt; integer.<br />
&gt; <br />
&gt; <br />
&gt; 1==&quot;1&quot;          // always convert the number value to a string and then<br />
&gt; compare it<br />
&gt; &quot;foo&quot; == 0    //  should return false<br />
&gt; <br />
&gt; &quot;123abc&quot; == &quot;123nth&quot; // compare as string. Do not convert to numeric values<br />
&gt; <br />
&gt; &quot;0&quot;==0     //  true<br />
&gt; 0==&quot;0.&quot;  // false<br />
&gt; <br />
&gt; PHP is great but if we can work together to remove the flaws, then we can<br />
&gt; make it even greater. We have to leave the past behind us and look at where<br />
&gt; we want PHP to be in the next 5 years<br />
&gt; <br />
&gt; <br />
&gt; Best regards,<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>Matt Wilson</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 08 May 2012 04:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491787#msg-491787</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491787#msg-491787</link>
            <description><![CDATA[ I was very surprised when I came across the == issue sometime ago. IMO<br />
strings should be compared as strings. They should never be converted to<br />
integer.<br />
<br />
<br />
1==&quot;1&quot;          // always convert the number value to a string and then<br />
compare it<br />
&quot;foo&quot; == 0    //  should return false<br />
<br />
&quot;123abc&quot; == &quot;123nth&quot; // compare as string. Do not convert to numeric values<br />
<br />
&quot;0&quot;==0     //  true<br />
0==&quot;0.&quot;  // false<br />
<br />
PHP is great but if we can work together to remove the flaws, then we can<br />
make it even greater. We have to leave the past behind us and look at where<br />
we want PHP to be in the next 5 years<br />
<br />
<br />
Best regards,]]></description>
            <dc:creator>Raymond Irving</dc:creator>
            <category>php-internals</category>
            <pubDate>Tue, 08 May 2012 03:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491592#msg-491592</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491592#msg-491592</link>
            <description><![CDATA[ &gt; On 05/07/2012 05:32 AM, Tjerk Anne Meesters wrote:<br />
&gt;<br />
&gt;&gt; Validated or not, why would type juggling even come into the picture<br />
&gt;&gt; if both variables are of the same type?<br />
&gt;<br />
&gt; For the simple reason that web forms return all input as strings, even<br />
&gt; if the input is actually meant to be numeric<br />
&gt;<br />
&gt; Many PHP database backend functions also return all result fields<br />
&gt; as strings regardless of the actual result type, e.g. mysql_fetch_*(),<br />
&gt; mysqli_fetch_*() and pg_fetch_*()  (although that's more debatable)<br />
<br />
Granted, I realized that my comment came across a bit too generic.<br />
What I meant to say is that the type juggling should be applied within<br />
its realm of usefulness and skipped otherwise lest it tell me &quot;they're<br />
both pretty big numbers&quot; :)<br />
<br />
I've always felt overly pedantic when I used === or strcmp() in string<br />
comparisons (assuming the equality edge cases were not an issue; e.g.<br />
same string composition).<br />
<br />
&gt;<br />
&gt; So if both operands look numeric (even though they are actually of<br />
&gt; type string) type juggling kicks, and in your MD5 example it<br />
&gt; unfortunately kicks in with a conversion to float for both sides<br />
&gt; and you're running into the &quot;never compare floats for equality&quot;<br />
&gt; trap ... (which is being worked on for the string comparison case<br />
&gt; though, i just don't have the bug number at hand right now)<br />
<br />
I'm assuming that you're referring to this bug reference:<br />
<a href="https://bugs.php.net/bug.php?id=54547" target="_blank"  rel="nofollow">https://bugs.php.net/bug.php?id=54547</a><br />
<br />
The proposed patch therein looks okay, though I'm not sure why the<br />
added test case is for 64bit systems only; seems to me that it can /<br />
should be run for other systems too.<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>Tjerk Anne Meesters</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 20:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491399#msg-491399</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491399#msg-491399</link>
            <description><![CDATA[ On 05/07/2012 05:32 AM, Tjerk Anne Meesters wrote:<br />
<br />
&gt; Validated or not, why would type juggling even come into the picture<br />
&gt; if both variables are of the same type?<br />
<br />
For the simple reason that web forms return all input as strings, even<br />
if the input is actually meant to be numeric<br />
<br />
Many PHP database backend functions also return all result fields<br />
as strings regardless of the actual result type, e.g. mysql_fetch_*(),<br />
mysqli_fetch_*() and pg_fetch_*()  (although that's more debatable)<br />
<br />
So if both operands look numeric (even though they are actually of<br />
type string) type juggling kicks, and in your MD5 example it<br />
unfortunately kicks in with a conversion to float for both sides<br />
and you're running into the &quot;never compare floats for equality&quot;<br />
trap ... (which is being worked on for the string comparison case<br />
though, i just don't have the bug number at hand right now)<br />
<br />
-- <br />
hartmut<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>Hartmut Holzgraefe</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 14:40:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491396#msg-491396</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491396#msg-491396</link>
            <description><![CDATA[ On 05/07/2012 09:28 AM, Arvids Godjuks wrote:<br />
&gt; Hello internals,<br />
&gt; <br />
&gt; I should voice my opinion that such things like comparing two strings<br />
&gt; starting with numbers and that they resolve to actual integer/float for<br />
&gt; comparation is bad, really bad. That just defies the logic and yealds<br />
&gt; absolutly unexpected results. I pride myself that i know the juggling rules<br />
&gt; well, but I'm shocked by this to say the least..<br />
<br />
you have to see this in the &quot;web context&quot; where all input from a<br />
HTTP client arrives as strings without type information (and some<br />
database result data comes in as string data, too)<br />
<br />
In that context it perfectly makes sense that<br />
<br />
  &quot;1&quot; == &quot;1.0&quot;<br />
<br />
returns true even if both operands are strings.<br />
<br />
&quot;123ABF453...&quot; == &quot;123DFEABC...&quot; is a different story though,<br />
and guess what? These are *not* considered equal, at least not<br />
by the 5.3.6 instance on the system i'm currently testing with:<br />
<br />
  &lt;?php<br />
  $a = &quot;123ABF453...&quot;; //a password<br />
  $b = &quot;123DFEABC...&quot;; //another one<br />
  if ($a == $b){<br />
    echo &quot;you're in&quot;;<br />
  } else {<br />
    echo &quot;no, you don't get in *that* easy!&quot;;<br />
  }<br />
  ?&gt;<br />
<br />
will print &quot;no, you don't get in *that* easy!&quot; just fine<br />
<br />
-- <br />
hartmut<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>Hartmut Holzgraefe</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 14:30:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491342#msg-491342</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491342#msg-491342</link>
            <description><![CDATA[ Easy - you see == everywhere and === is used rarely, in docs you see it in<br />
some places like strpos(). This is one thing that has to be communicated<br />
through every channel available (including docs) with clear examples that<br />
show why it should be used instead of ==.<br />
Take me for example, I never had any idea that comparing two hashes that<br />
start with numbers can generate a logical truth despite the hashes being<br />
different. I haven't seen anything related to this in docs and never<br />
stumbled upon in the internet, ever. So I use == for comparing strings all<br />
the time. Now I will change that because I have the knowledge why I should<br />
use === instead of ==.<br />
Well, now I do know, from this mailing list (witch is for PHP development)<br />
- not many user-land developers read this list.<br />
<br />
And in my previous message I said essentially the same as you did, just in<br />
different words and style. English is not my native language and I have<br />
been learning the British variant of it, so it's more formal that<br />
American English :)<br />
<br />
2012/5/7 Kris Craig &lt;kris.craig@gmail.com&gt;<br />
<br />
&gt;<br />
&gt;<br />
&gt; On Mon, May 7, 2012 at 12:28 AM, Arvids Godjuks &lt;arvids.godjuks@gmail.com&gt;wrote:<br />
&gt;<br />
&gt;&gt; Hello internals,<br />
&gt;&gt;<br />
&gt;&gt; I should voice my opinion that such things like comparing two strings<br />
&gt;&gt; starting with numbers and that they resolve to actual integer/float for<br />
&gt;&gt; comparation is bad, really bad. That just defies the logic and yealds<br />
&gt;&gt; absolutly unexpected results. I pride myself that i know the juggling<br />
&gt;&gt; rules<br />
&gt;&gt; well, but I'm shocked by this to say the least...<br />
&gt;&gt; In my opinion this should change no matter the BC breaks it will create,<br />
&gt;&gt; this one affects security big time. It's good I actually hash my passwrds<br />
&gt;&gt; in the MySQL and not on the PHP side, but I have seen hash comparations<br />
&gt;&gt; with == all the time. And now that this has been discussed in detail I<br />
&gt;&gt; expect this to be used as an attack method grow wide.<br />
&gt;&gt; 07.05.2012 5:32 пользователь &quot;Tjerk Anne Meesters&quot; &lt;datibbaw@php.net&gt;<br />
&gt;&gt; написал:<br />
&gt;<br />
&gt;<br />
&gt; Forgive me if I'm missing something, but why are people using == for<br />
&gt; security-sensitive string comparisons (like hashed passwords) in the first<br />
&gt; place?!  If you needs something that's safe, isn't that what strcmp() and<br />
&gt; strcasecmp() are for?  For my part, I pretty much never use == on string<br />
&gt; comparison, though admittedly that's probably just a matter of having<br />
&gt; having come from a C background before PHP.<br />
&gt;<br />
&gt; That being said, I agree that this *definitely* should be fixed if the<br />
&gt; examples cited are indeed accurate (I've been working with PHP for over 10<br />
&gt; years and I was never aware of this bizarre behavior, either).  I don't<br />
&gt; know the history of this, but I at least would consider it to be a bug.  A<br />
&gt; rather large one, in fact; though I think some of the fears expressed are a<br />
&gt; bit hyperbolic.  And if you're fixing a serious bug or security<br />
&gt; vulnerability, as a general rule of thumb, this automatically supercedes<br />
&gt; any concerns regarding BC breakage IMHO.  But if that really is a lingering<br />
&gt; concern, I'd suggest targetting the fix for PHP 6, since people would (or<br />
&gt; at least should) expect that some PHP 5 code may behave differently in PHP<br />
&gt; 6 anyway given that it's a major release<br />
&gt;<br />
&gt; --Kris<br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Arvids Godjuks</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 12:50:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491319#msg-491319</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491319#msg-491319</link>
            <description><![CDATA[ &gt;<br />
&gt; I agree with Rasmus (and others) on this one<br />
&gt; (http://www.mail-archive.com/internals@lists.php.net/msg57949.html), type<br />
&gt; numeric conversion on strings on both sides should only happen if both<br />
&gt; strings can be represented as numbers without losing data/precision.<br />
&gt; if one or both of the two sides can't be converted to numeric without data<br />
&gt; loss, then we should compare them as strings.<br />
&gt; the patch from Cataphract (attached at<br />
&gt; <a href="https://bugs.php.net/bug.php?id=54547" target="_blank"  rel="nofollow">https://bugs.php.net/bug.php?id=54547</a>) implements this behavior<br />
&gt;<br />
<br />
+1 ... that patch has been lying on a dusty shelf for more than a year =p<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>Tjerk Anne Meesters</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 11:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491318#msg-491318</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491318#msg-491318</link>
            <description><![CDATA[ On Mon, May 7, 2012 at 11:22 AM, Kris Craig &lt;kris.craig@gmail.com&gt; wrote:<br />
<br />
&gt; On Mon, May 7, 2012 at 1:46 AM, Gustavo Lopes &lt;glopes@nebm.ist.utl.pt<br />
&gt; &gt;wrote:<br />
&gt;<br />
&gt; &gt; On Mon, 07 May 2012 10:31:00 +0200, Kris Craig &lt;kris.craig@gmail.com&gt;<br />
&gt; &gt; wrote:<br />
&gt; &gt;<br />
&gt; &gt;  That being said, I agree that this *definitely* should be fixed if the<br />
&gt; &gt;&gt;<br />
&gt; &gt;&gt; examples cited are indeed accurate (I've been working with PHP for over<br />
&gt; &gt;&gt; 10 years and I was never aware of this bizarre behavior, either).  I<br />
&gt; don't<br />
&gt; &gt;&gt; know the history of this, but I at least would consider it to be a bug..<br />
&gt; &gt;&gt;  A rather large one, in fact; though I think some of the fears expressed<br />
&gt; &gt;&gt; are a bit hyperbolic.  And if you're fixing a serious bug or security<br />
&gt; &gt;&gt; vulnerability, as a general rule of thumb, this automatically supercedes<br />
&gt; &gt;&gt; any concerns regarding BC breakage IMHO.<br />
&gt; &gt;&gt;<br />
&gt; &gt;<br />
&gt; &gt; This has already been discussed in its own thread, see<br />
&gt; &gt; <a href="http://comments.gmane.org/**gmane.comp.php.devel/72790&lt" target="_blank"  rel="nofollow">http://comments.gmane.org/**gmane.comp.php.devel/72790&lt</a>;<br />
&gt; <a href="http://comments.gmane.org/gmane.comp.php.devel/72790&gt" target="_blank"  rel="nofollow">http://comments.gmane.org/gmane.comp.php.devel/72790&gt</a>;; see also<br />
&gt; &gt; <a href="https://bugs.php.net/bug.php?**id=54547&lt" target="_blank"  rel="nofollow">https://bugs.php.net/bug.php?**id=54547&lt</a>;<br />
&gt; <a href="https://bugs.php.net/bug.php?id=54547&gt" target="_blank"  rel="nofollow">https://bugs.php.net/bug.php?id=54547&gt</a>;<br />
&gt; &gt;<br />
&gt; &gt; Doing away entirely with this behavior (e.g. making &quot; 2&quot; == &quot;2&quot; compare<br />
&gt; &gt; false) would be a rather large BC break, that discussion is restricted to<br />
&gt; &gt; whether integers in strings should be treated differently from integer<br />
&gt; &gt; literals for comparison purposes when their range is exceeded. I wrote a<br />
&gt; &gt; patch for that, and, while not really caring one way or the other, I'm<br />
&gt; not<br />
&gt; &gt; convinced it's necessary and I some have consistency concerns (though<br />
&gt; float<br />
&gt; &gt; overflows already get a similar treatment).<br />
&gt; &gt;<br />
&gt; &gt; --<br />
&gt; &gt; Gustavo Lopes<br />
&gt; &gt;<br />
&gt;<br />
&gt; Agreed.  While it's no secret that I believe optional strong typing would<br />
&gt; be helpful in this context, setting that aside I would definitely not want<br />
&gt; to see implicit conversions like &quot;2&quot; == 2 or even &quot; 2&quot; == 2 go away (though<br />
&gt; I do wish more PHP devs were familiar with the various trim() functions<br />
&gt; lol).<br />
&gt;<br />
&gt; That being said, this is what had me scratching my head from a previous<br />
&gt; message in this thread:<br />
&gt;<br />
&gt; &gt;$a = &quot;123ABF453...&quot;; //a password<br />
&gt; &gt;$b = &quot;123DFEABC...&quot;; //another one<br />
&gt; &gt;if ($a == $b){<br />
&gt; &gt; //you're in.<br />
&gt; &gt;}<br />
&gt;<br />
&gt;<br />
&gt; The thought that $a == $b would actually evaluate to TRUE is utterly<br />
&gt; absurd....  Only catch is, it doesn't.  As I was sharpening my pitchfork<br />
&gt; getting ready to argue why this should be considered a bug and not<br />
&gt; conflated with implicit conversions like &quot; 2&quot; == 2, I decided to do a<br />
&gt; little test script against 5.3.11.  I was unable to reproduce the behavior<br />
&gt; being reported in the above example.  In my tests, $a == $b returned FALSE.<br />
&gt;  As it should.<br />
&gt;<br />
&gt;<br />
juggling won't happen here, because both sides are strings, and they aren't<br />
numerical strings, so that example was bogus indeed.<br />
the discussion here is about whether it is not expected that the numerical<br />
strings will compared as numbers even in they can only represented as<br />
number if some kind of precision loss occurs.<br />
about numerical strings:<br />
<a href="http://php.net/manual/en/language.operators.comparison.php" target="_blank"  rel="nofollow">http://php.net/manual/en/language.operators.comparison.php</a><br />
&quot;If you compare a number with a string or the comparison involves numerical<br />
strings, then each string is converted to a<br />
number&lt;<a href="http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion&gt" target="_blank"  rel="nofollow">http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion&gt</a>;<br />
and<br />
the comparison performed numerically. These rules also apply to the<br />
switch<a href="http://www.php.net/manual/en/control-structures.switch.php" target="_blank"  rel="nofollow">http://www.php.net/manual/en/control-structures.switch.php</a><br />
statement.<br />
The type conversion does not take place when the comparison is === or !==<br />
as this involves comparing the type as well as the value.&quot;<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>Mon, 07 May 2012 11:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491315#msg-491315</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491315#msg-491315</link>
            <description><![CDATA[ On Mon, May 7, 2012 at 1:46 AM, Gustavo Lopes &lt;glopes@nebm.ist.utl.pt&gt;wrote:<br />
<br />
&gt; On Mon, 07 May 2012 10:31:00 +0200, Kris Craig &lt;kris.craig@gmail.com&gt;<br />
&gt; wrote:<br />
&gt;<br />
&gt;  That being said, I agree that this *definitely* should be fixed if the<br />
&gt;&gt;<br />
&gt;&gt; examples cited are indeed accurate (I've been working with PHP for over<br />
&gt;&gt; 10 years and I was never aware of this bizarre behavior, either).  I don't<br />
&gt;&gt; know the history of this, but I at least would consider it to be a bug.<br />
&gt;&gt;  A rather large one, in fact; though I think some of the fears expressed<br />
&gt;&gt; are a bit hyperbolic.  And if you're fixing a serious bug or security<br />
&gt;&gt; vulnerability, as a general rule of thumb, this automatically supercedes<br />
&gt;&gt; any concerns regarding BC breakage IMHO.<br />
&gt;&gt;<br />
&gt;<br />
&gt; This has already been discussed in its own thread, see<br />
&gt; <a href="http://comments.gmane.org/**gmane.comp.php.devel/72790http://comments.gmane.org/gmane.comp.php.devel/72790" target="_blank"  rel="nofollow">http://comments.gmane.org/**gmane.comp.php.devel/72790http://comments.gmane.org/gmane.comp.php.devel/72790</a>; see also<br />
&gt; <a href="https://bugs.php.net/bug.php?**id=54547https://bugs.php.net/bug.php?id=54547" target="_blank"  rel="nofollow">https://bugs.php.net/bug.php?**id=54547https://bugs.php.net/bug.php?id=54547</a><br />
&gt;<br />
&gt; Doing away entirely with this behavior (e.g. making &quot; 2&quot; == &quot;2&quot; compare<br />
&gt; false) would be a rather large BC break, that discussion is restricted to<br />
&gt; whether integers in strings should be treated differently from integer<br />
&gt; literals for comparison purposes when their range is exceeded. I wrote a<br />
&gt; patch for that, and, while not really caring one way or the other, I'm not<br />
&gt; convinced it's necessary and I some have consistency concerns (though float<br />
&gt; overflows already get a similar treatment).<br />
&gt;<br />
&gt; --<br />
&gt; Gustavo Lopes<br />
&gt;<br />
<br />
Agreed.  While it's no secret that I believe optional strong typing would<br />
be helpful in this context, setting that aside I would definitely not want<br />
to see implicit conversions like &quot;2&quot; == 2 or even &quot; 2&quot; == 2 go away (though<br />
I do wish more PHP devs were familiar with the various trim() functions<br />
lol).<br />
<br />
That being said, this is what had me scratching my head from a previous<br />
message in this thread:<br />
<br />
&gt;$a = &quot;123ABF453...&quot;; //a password<br />
&gt;$b = &quot;123DFEABC...&quot;; //another one<br />
&gt;if ($a == $b){<br />
&gt; //you're in.<br />
&gt;}<br />
<br />
<br />
The thought that $a == $b would actually evaluate to TRUE is utterly<br />
absurd....  Only catch is, it doesn't.  As I was sharpening my pitchfork<br />
getting ready to argue why this should be considered a bug and not<br />
conflated with implicit conversions like &quot; 2&quot; == 2, I decided to do a<br />
little test script against 5.3.11.  I was unable to reproduce the behavior<br />
being reported in the above example.  In my tests, $a == $b returned FALSE.<br />
 As it should.<br />
<br />
@Richard Could you clarify what you were trying to illustrate with that<br />
code?  I wasn't able to find anything wrong with how PHP handled it.  So<br />
either you were mistaken or I misunderstood your point (if the latter,<br />
please tell me how so I can try again to repro the problem you're raising<br />
concern about).<br />
<br />
So with that in mind, the point I raised in the second paragraph of my last<br />
email is moot because I was referring to behavior that doesn't actually<br />
exist (again, unless I was testing for the wrong thing somehow?).  Implicit<br />
conversions like &quot; 1&quot; == 1.0 I fully support so long as they can both be<br />
converted to numbers without loss of precision.<br />
<br />
--Kris]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 11:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491293#msg-491293</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491293#msg-491293</link>
            <description><![CDATA[ On Mon, May 7, 2012 at 10:31 AM, Kris Craig &lt;kris.craig@gmail.com&gt; wrote:<br />
<br />
&gt; On Mon, May 7, 2012 at 12:28 AM, Arvids Godjuks &lt;arvids.godjuks@gmail.com<br />
&gt; &gt;wrote:<br />
&gt;<br />
&gt; &gt; Hello internals,<br />
&gt; &gt;<br />
&gt; &gt; I should voice my opinion that such things like comparing two strings<br />
&gt; &gt; starting with numbers and that they resolve to actual integer/float for<br />
&gt; &gt; comparation is bad, really bad. That just defies the logic and yealds<br />
&gt; &gt; absolutly unexpected results. I pride myself that i know the juggling<br />
&gt; rules<br />
&gt; &gt; well, but I'm shocked by this to say the least...<br />
&gt; &gt; In my opinion this should change no matter the BC breaks it will create,<br />
&gt; &gt; this one affects security big time. It's good I actually hash my<br />
&gt; passwords<br />
&gt; &gt; in the MySQL and not on the PHP side, but I have seen hash comparations<br />
&gt; &gt; with == all the time. And now that this has been discussed in detail I<br />
&gt; &gt; expect this to be used as an attack method grow wide.<br />
&gt; &gt; 07.05.2012 5:32 пользователь &quot;Tjerk Anne Meesters&quot; &lt;datibbaw@php.net&gt;<br />
&gt; &gt; написал:<br />
&gt;<br />
&gt;<br />
&gt; Forgive me if I'm missing something, but why are people using == for<br />
&gt; security-sensitive string comparisons (like hashed passwords) in the first<br />
&gt; place?!  If you needs something that's safe, isn't that what strcmp() and<br />
&gt; strcasecmp() are for?  For my part, I pretty much never use == on string<br />
&gt; comparison, though admittedly that's probably just a matter of having<br />
&gt; having come from a C background before PHP.<br />
&gt;<br />
&gt; That being said, I agree that this *definitely* should be fixed if the<br />
&gt; examples cited are indeed accurate (I've been working with PHP for over 10<br />
&gt; years and I was never aware of this bizarre behavior, either).  I don't<br />
&gt; know the history of this, but I at least would consider it to be a bug.  A<br />
&gt; rather large one, in fact; though I think some of the fears expressed are a<br />
&gt; bit hyperbolic.  And if you're fixing a serious bug or security<br />
&gt; vulnerability, as a general rule of thumb, this automatically supercedes<br />
&gt; any concerns regarding BC breakage IMHO.  But if that really is a lingering<br />
&gt; concern, I'd suggest targetting the fix for PHP 6, since people would (or<br />
&gt; at least should) expect that some PHP 5 code may behave differently in PHP<br />
&gt; 6 anyway given that it's a major release<br />
&gt;<br />
&gt;<br />
I agree with Rasmus (and others) on this one (<br />
<a href="http://www.mail-archive.com/internals@lists.php.net/msg57949.html" target="_blank"  rel="nofollow">http://www.mail-archive.com/internals@lists.php.net/msg57949.html</a>), type<br />
numeric conversion on strings on both sides should only happen if both<br />
strings can be represented as numbers without losing data/precision.<br />
if one or both of the two sides can't be converted to numeric without data<br />
loss, then we should compare them as strings.<br />
the patch from Cataphract (attached at <a href="https://bugs.php.net/bug.php?id=54547" target="_blank"  rel="nofollow">https://bugs.php.net/bug.php?id=54547</a>)<br />
implements this behavior<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>Mon, 07 May 2012 11:00:03 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491285#msg-491285</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491285#msg-491285</link>
            <description><![CDATA[ On Mon, 07 May 2012 10:31:00 +0200, Kris Craig &lt;kris.craig@gmail.com&gt;  <br />
wrote:<br />
<br />
&gt; That being said, I agree that this *definitely* should be fixed if the<br />
&gt; examples cited are indeed accurate (I've been working with PHP for over  <br />
&gt; 10 years and I was never aware of this bizarre behavior, either).  I  <br />
&gt; don't<br />
&gt; know the history of this, but I at least would consider it to be a bug.   <br />
&gt; A rather large one, in fact; though I think some of the fears expressed  <br />
&gt; are a bit hyperbolic.  And if you're fixing a serious bug or security<br />
&gt; vulnerability, as a general rule of thumb, this automatically supercedes<br />
&gt; any concerns regarding BC breakage IMHO.<br />
<br />
This has already been discussed in its own thread, see  <br />
<a href="http://comments.gmane.org/gmane.comp.php.devel/72790" target="_blank"  rel="nofollow">http://comments.gmane.org/gmane.comp.php.devel/72790</a> ; see also  <br />
<a href="https://bugs.php.net/bug.php?id=54547" target="_blank"  rel="nofollow">https://bugs.php.net/bug.php?id=54547</a><br />
<br />
Doing away entirely with this behavior (e.g. making &quot; 2&quot; == &quot;2&quot; compare  <br />
false) would be a rather large BC break, that discussion is restricted to  <br />
whether integers in strings should be treated differently from integer  <br />
literals for comparison purposes when their range is exceeded. I wrote a  <br />
patch for that, and, while not really caring one way or the other, I'm not  <br />
convinced it's necessary and I some have consistency concerns (though  <br />
float overflows already get a similar treatment).<br />
<br />
-- <br />
Gustavo Lopes<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>Gustavo Lopes</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 10:50:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491279#msg-491279</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491279#msg-491279</link>
            <description><![CDATA[ On Mon, May 7, 2012 at 12:28 AM, Arvids Godjuks &lt;arvids.godjuks@gmail.com&gt;wrote:<br />
<br />
&gt; Hello internals,<br />
&gt;<br />
&gt; I should voice my opinion that such things like comparing two strings<br />
&gt; starting with numbers and that they resolve to actual integer/float for<br />
&gt; comparation is bad, really bad. That just defies the logic and yealds<br />
&gt; absolutly unexpected results. I pride myself that i know the juggling rules<br />
&gt; well, but I'm shocked by this to say the least...<br />
&gt; In my opinion this should change no matter the BC breaks it will create,<br />
&gt; this one affects security big time. It's good I actually hash my passwords<br />
&gt; in the MySQL and not on the PHP side, but I have seen hash comparations<br />
&gt; with == all the time. And now that this has been discussed in detail I<br />
&gt; expect this to be used as an attack method grow wide.<br />
&gt; 07.05.2012 5:32 пользователь &quot;Tjerk Anne Meesters&quot; &lt;datibbaw@php.net&gt;<br />
&gt; написал:<br />
<br />
<br />
Forgive me if I'm missing something, but why are people using == for<br />
security-sensitive string comparisons (like hashed passwords) in the first<br />
place?!  If you needs something that's safe, isn't that what strcmp() and<br />
strcasecmp() are for?  For my part, I pretty much never use == on string<br />
comparison, though admittedly that's probably just a matter of having<br />
having come from a C background before PHP.<br />
<br />
That being said, I agree that this *definitely* should be fixed if the<br />
examples cited are indeed accurate (I've been working with PHP for over 10<br />
years and I was never aware of this bizarre behavior, either).  I don't<br />
know the history of this, but I at least would consider it to be a bug.  A<br />
rather large one, in fact; though I think some of the fears expressed are a<br />
bit hyperbolic.  And if you're fixing a serious bug or security<br />
vulnerability, as a general rule of thumb, this automatically supercedes<br />
any concerns regarding BC breakage IMHO.  But if that really is a lingering<br />
concern, I'd suggest targetting the fix for PHP 6, since people would (or<br />
at least should) expect that some PHP 5 code may behave differently in PHP<br />
6 anyway given that it's a major release<br />
<br />
--Kris]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 10:40:07 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491235#msg-491235</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491235#msg-491235</link>
            <description><![CDATA[ Hello internals,<br />
<br />
I should voice my opinion that such things like comparing two strings<br />
starting with numbers and that they resolve to actual integer/float for<br />
comparation is bad, really bad. That just defies the logic and yealds<br />
absolutly unexpected results. I pride myself that i know the juggling rules<br />
well, but I'm shocked by this to say the least...<br />
In my opinion this should change no matter the BC breaks it will create,<br />
this one affects security big time. It's good I actually hash my passwords<br />
in the MySQL and not on the PHP side, but I have seen hash comparations<br />
with == all the time. And now that this has been discussed in detail I<br />
expect this to be used as an attack method grow wide.<br />
07.05.2012 5:32 пользователь &quot;Tjerk Anne Meesters&quot; &lt;datibbaw@php.net&gt;<br />
написал:<br />
<br />
&gt; On Sun, May 6, 2012 at 12:17 AM, Richard Lynch &lt;ceo@l-i-e.com&gt; wrote:<br />
&gt; &gt;&gt; What exactly valid points? == is a converting operator, === is a<br />
&gt; &gt;&gt; strict<br />
&gt; &gt;&gt; operator. OK, in his favorite language it is not. Where exactly the<br />
&gt; &gt;&gt; valid point is? Author goes at great lengths to refuse to make even a<br />
&gt; &gt;&gt; slight mental effort to understand how it works (really, it's not that<br />
&gt; &gt;&gt; hard) and then complains it's &quot;useless&quot;. Well, a lot of things would<br />
&gt; &gt;&gt; be<br />
&gt; &gt;&gt; useless if you don't want to know how to use them.<br />
&gt; &gt;<br />
&gt; &gt; He has a few valid points in the part I read before I got bored...<br />
&gt; &gt;<br />
&gt; &gt; $a = &quot;123ABF453...&quot;; //a password<br />
&gt; &gt; $b = &quot;123DFEABC...&quot;; //another one<br />
&gt; &gt; if ($a == $b){<br />
&gt; &gt;  //you're in.<br />
&gt; &gt; }<br />
&gt; &gt;<br />
&gt; &gt; Yes, one should have validated the input...<br />
&gt; &gt;<br />
&gt; &gt; But you don't have to be THAT naive to think that the hashed value of<br />
&gt; &gt; an SQL injection attack just isn't going to work, so it's &quot;safe&quot;...<br />
&gt; &gt;<br />
&gt; &gt; I'll bet I have some of these in my (recent) code, for that matter.<br />
&gt; &gt;<br />
&gt; &gt; On the other hand, if you accept type juggling, you have to expect the<br />
&gt; &gt; other cases he has for == being a bit strange.<br />
&gt;<br />
&gt; Validated or not, why would type juggling even come into the picture<br />
&gt; if both variables are of the same type?<br />
&gt;<br />
&gt; 123 == &quot;123abc&quot; // sure, why not<br />
&gt; &quot;61529519452809720693702583126814&quot; ==<br />
&gt; &quot;61529519452809720000000000000000&quot; // WAT?!<br />
&gt;<br />
&gt; In the above, only the first ~50% of an md5 hash has to be correct.<br />
&gt; This gets even worse for SHA256 hashes.<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;]]></description>
            <dc:creator>Arvids Godjuks</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 09:30:05 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,491176#msg-491176</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,491176#msg-491176</link>
            <description><![CDATA[ On Sun, May 6, 2012 at 12:17 AM, Richard Lynch &lt;ceo@l-i-e.com&gt; wrote:<br />
&gt;&gt; What exactly valid points? == is a converting operator, === is a<br />
&gt;&gt; strict<br />
&gt;&gt; operator. OK, in his favorite language it is not. Where exactly the<br />
&gt;&gt; valid point is? Author goes at great lengths to refuse to make even a<br />
&gt;&gt; slight mental effort to understand how it works (really, it's not that<br />
&gt;&gt; hard) and then complains it's &quot;useless&quot;. Well, a lot of things would<br />
&gt;&gt; be<br />
&gt;&gt; useless if you don't want to know how to use them.<br />
&gt;<br />
&gt; He has a few valid points in the part I read before I got bored...<br />
&gt;<br />
&gt; $a = &quot;123ABF453...&quot;; //a password<br />
&gt; $b = &quot;123DFEABC...&quot;; //another one<br />
&gt; if ($a == $b){<br />
&gt;  //you're in.<br />
&gt; }<br />
&gt;<br />
&gt; Yes, one should have validated the input...<br />
&gt;<br />
&gt; But you don't have to be THAT naive to think that the hashed value of<br />
&gt; an SQL injection attack just isn't going to work, so it's &quot;safe&quot;...<br />
&gt;<br />
&gt; I'll bet I have some of these in my (recent) code, for that matter.<br />
&gt;<br />
&gt; On the other hand, if you accept type juggling, you have to expect the<br />
&gt; other cases he has for == being a bit strange.<br />
<br />
Validated or not, why would type juggling even come into the picture<br />
if both variables are of the same type?<br />
<br />
123 == &quot;123abc&quot; // sure, why not<br />
&quot;61529519452809720693702583126814&quot; ==<br />
&quot;61529519452809720000000000000000&quot; // WAT?!<br />
<br />
In the above, only the first ~50% of an md5 hash has to be correct.<br />
This gets even worse for SHA256 hashes.<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>Tjerk Anne Meesters</dc:creator>
            <category>php-internals</category>
            <pubDate>Mon, 07 May 2012 05:40:03 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,490861#msg-490861</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,490861#msg-490861</link>
            <description><![CDATA[ On Tue, April 10, 2012 1:27 pm, Stas Malyshev wrote:<br />
&gt; Hi!<br />
&gt;<br />
&gt;&gt; Scroll down a bit; he gets into valid points about the == operator,<br />
&gt;&gt; for instance. It's not a useless post. He does cite too many things<br />
&gt;&gt; that he has to follow up himself by saying &quot;this was fixed in PHP<br />
&gt;&gt; 5.x.y.&quot; If it was fixed, why is it on your laundry list still?<br />
&gt;<br />
&gt; What exactly valid points? == is a converting operator, === is a<br />
&gt; strict<br />
&gt; operator. OK, in his favorite language it is not. Where exactly the<br />
&gt; valid point is? Author goes at great lengths to refuse to make even a<br />
&gt; slight mental effort to understand how it works (really, it's not that<br />
&gt; hard) and then complains it's &quot;useless&quot;. Well, a lot of things would<br />
&gt; be<br />
&gt; useless if you don't want to know how to use them.<br />
<br />
He has a few valid points in the part I read before I got bored...<br />
<br />
$a = &quot;123ABF453...&quot;; //a password<br />
$b = &quot;123DFEABC...&quot;; //another one<br />
if ($a == $b){<br />
  //you're in.<br />
}<br />
<br />
Yes, one should have validated the input...<br />
<br />
But you don't have to be THAT naive to think that the hashed value of<br />
an SQL injection attack just isn't going to work, so it's &quot;safe&quot;...<br />
<br />
I'll bet I have some of these in my (recent) code, for that matter.<br />
<br />
On the other hand, if you accept type juggling, you have to expect the<br />
other cases he has for == being a bit strange.<br />
<br />
-- <br />
brain cancer update:<br />
<a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
Donate:<br />
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><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>Richard Lynch</dc:creator>
            <category>php-internals</category>
            <pubDate>Sat, 05 May 2012 18:20:01 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,481541#msg-481541</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,481541#msg-481541</link>
            <description><![CDATA[ On Apr 18, 2012, at 1:34 AM, Hartmut Holzgraefe wrote:<br />
<br />
&gt; On 04/10/2012 06:20 PM, Adir Kuhn wrote:<br />
&gt;&gt; Hi folks,<br />
&gt;&gt; <br />
&gt;&gt; today I read this post, I think that some points are valid, follow the link for<br />
&gt;&gt; you guys<br />
&gt; <br />
&gt; as stuff like this comes up again and again (although not in as epic<br />
&gt; lenght as this one) i've been thinking whether it might make sense to<br />
&gt; have some<br />
&gt; <br />
&gt; &quot;PHP Gotchas, how they came to be, and why we can't simply fix them&quot;<br />
&gt; <br />
&gt; FAQ section in the manual or wiki?<br />
&gt; <br />
&gt; If nothing else it would at least help with dealing with this kind<br />
&gt; of rant (nothing new here, move along, your concerns were already<br />
&gt; covered in ### in great detail), but also might help that would<br />
&gt; indeed want to understand why some things are as they are.<br />
&gt; <br />
&gt; I'd rather proactively own this kind of discussions than just<br />
&gt; jump into them whenever they arise elsewhere …<br />
<br />
Hello Hartmut,<br />
<br />
Agreed, and I think it belongs in the manual. An example (not being<br />
proposed as such, but is a rough idea):<br />
<br />
  Why are function naming schemes seemingly random?<br />
<br />
    PHP glues many different API's together, and sometimes this<br />
    gets messy. PHP leans towards the C variant which is why the<br />
    likes of strlen() vs str_replace() exists, and …<br />
<br />
As opposed to our current approach, which is via mailing lists and <br />
typically &quot;RTFM.&quot; or &quot;BC. Read archives.&quot; or the like. Ack!<br />
<br />
And also include possible solutions/recommendations like this PHP FAQ<br />
entry about haystack,needle ordering, which includes the following <br />
text:<br />
<br />
    A simple rule of thumb is as follows: Array function parameters <br />
    are ordered as &quot;needle, haystack&quot; whereas String functions are the <br />
    opposite, so &quot;haystack, needle&quot;.<br />
<br />
And thankfully there are already a lot of sites to steal the questions <br />
from, and often answers live within their user comments. :)<br />
<br />
Regards,<br />
Philip<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>Philip Olson</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 18 Apr 2012 11:00:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,481539#msg-481539</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,481539#msg-481539</link>
            <description><![CDATA[ On 04/11/2012 05:19 PM, Luke Scott wrote:<br />
<br />
&gt; The only thing that infuriates me is the ternary operator being left<br />
&gt; associative. I want that fixed - screw bc on that one! I have been<br />
&gt; programming for 10 years and that one still confuses me! Most people<br />
&gt; just add parentheses to &quot;fix&quot; the problem. I wish someone would write<br />
&gt; an RFC to change this to right associative like every other language!<br />
&gt; *hint hint*<br />
<br />
i actually never noticed this until now as i keep it as a best practice<br />
to never nest ternaries anyway, in any language. To me it's at least as<br />
much a sign for a desseased mind as using multiple exclamation marks<br />
!!!11eleven ;)<br />
<br />
The problem i see though is that in code that really relies on this it<br />
may become a real nightmare to track down what goes wrong if evaluation<br />
order is changed if you're not aware of that change having happened.<br />
<br />
An E_DEPRECATED may help here, but will also produce a lot of false<br />
positives for those using parentheses? Or can we add enough parser<br />
magic to only throw warnings for the unsafe uses? ...<br />
<br />
-- <br />
hartmut<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>Hartmut Holzgraefe</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 18 Apr 2012 10:50:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,481532#msg-481532</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,481532#msg-481532</link>
            <description><![CDATA[ On 04/10/2012 06:20 PM, Adir Kuhn wrote:<br />
&gt; Hi folks,<br />
&gt; <br />
&gt; today I read this post, I think that some points are valid, follow the link for<br />
&gt; you guys<br />
<br />
as stuff like this comes up again and again (although not in as epic<br />
lenght as this one) i've been thinking whether it might make sense to<br />
have some<br />
<br />
 &quot;PHP Gotchas, how they came to be, and why we can't simply fix them&quot;<br />
<br />
FAQ section in the manual or wiki?<br />
<br />
If nothing else it would at least help with dealing with this kind<br />
of rant (nothing new here, move along, your concerns were already<br />
covered in ### in great detail), but also might help that would<br />
indeed want to understand why some things are as they are.<br />
<br />
I'd rather proactively own this kind of discussions than just<br />
jump into them whenever they arise elsewhere ...<br />
<br />
-- <br />
hartmut<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>Hartmut Holzgraefe</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 18 Apr 2012 10:40:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,477468#msg-477468</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,477468#msg-477468</link>
            <description><![CDATA[ -----BEGIN PGP SIGNED MESSAGE-----<br />
Hash: SHA1<br />
<br />
Am 10.04.2012 20:28, schrieb Kris Craig:<br />
&gt; On Tue, Apr 10, 2012 at 11:12 AM, Ralf Lang &lt;lang@b1-systems.de&gt;<br />
&gt; wrote:<br />
&gt; <br />
&gt;&gt;&gt;&gt; It always amuses me when PERL developers go on their little <br />
&gt;&gt;&gt;&gt; soapboxes about how &quot;real&quot; programmers all think PHP is<br />
&gt;&gt;&gt;&gt; stupid lol.<br />
&gt; <br />
&gt; It always amuses me PHP people think perl is stupid and vice<br />
&gt; versa. Both languages have their use case, sometimes I even use<br />
&gt; them side by side in the same project. PHP daemons and forking is<br />
&gt; not exactly what I would depend on working reliably.<br />
&gt; <br />
&gt; <br />
&gt;&gt; Umm at what point did I say PERL is &quot;stupid?&quot;  PERL is like the<br />
&gt;&gt; duct-tape of scripting languages; it can be used for just about<br />
&gt;&gt; anything, though there's almost always a more specialized<br />
&gt;&gt; solution.  It serves a purpose.<br />
<br />
I did not mean you personally told anything about perl. Of course perl<br />
serves a purpose. That's why it's still around.<br />
<br />
<br />
<br />
- -- <br />
Ralf Lang<br />
Linux Consultant / Developer<br />
Tel.: +49-170-6381563<br />
Mail: <a href="mailto:&#108;&#97;&#110;&#103;&#64;&#98;&#49;&#45;&#115;&#121;&#115;&#116;&#101;&#109;&#115;&#46;&#100;&#101;">&#108;&#97;&#110;&#103;&#64;&#98;&#49;&#45;&#115;&#121;&#115;&#116;&#101;&#109;&#115;&#46;&#100;&#101;</a><br />
<br />
B1 Systems GmbH<br />
Osterfeldstraße 7 / 85088 Vohburg / <a href="http://www.b1-systems.de" target="_blank"  rel="nofollow">http://www.b1-systems.de</a><br />
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537<br />
-----BEGIN PGP SIGNATURE-----<br />
Version: GnuPG v2.0.18 (GNU/Linux)<br />
Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org/" target="_blank"  rel="nofollow">http://enigmail.mozdev.org/</a><br />
<br />
iEYEARECAAYFAk+F8x8ACgkQCs1dsHJ/X7AjMACfcGvNM7Nz6FBQ2yZDNtiw9L7M<br />
AFsAoMjTbEtdQcicPuayb8GAtOTi5F0I<br />
=wLGk<br />
-----END PGP SIGNATURE-----<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>Ralf Lang</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 11 Apr 2012 23:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,477458#msg-477458</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,477458#msg-477458</link>
            <description><![CDATA[ On Wed, 2012-04-11 at 19:44 +0100, Lester Caine wrote:<br />
&gt; Anthony Ferrara wrote:<br />
&gt; &gt; Even with PDO and older versions of MySQL, you could inject into<br />
&gt; &gt; prepared statements quite easily (assuming charset settings):<br />
&gt; &gt;<br />
&gt; &gt; $var = '1' . chr(0xbf) . chr(0x27) . ' OR 1=1';<br />
&gt; &gt;<br />
&gt; &gt; $pdo = new PDO('mysql:...');<br />
&gt; &gt; $pdo-&gt;query('SET NAMES GBK');<br />
&gt; &gt; $stmt = $pdo-&gt;prepare('SELECT * FROM foo WHERE 2 = ?');<br />
&gt; &gt; $stmt-&gt;bindParam(1, $var);<br />
&gt; &gt; $stmt-&gt;execute();<br />
&gt; &gt;<br />
&gt; &gt; Without setting $pdo-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, 0)<br />
&gt; &gt; first, that will successfully inject into the query thanks to how PDO<br />
&gt; &gt; emulates prepares.<br />
&gt; &gt;<br />
&gt; &gt; A problem that true prepared statements (MySQLi and if PDO has emulate<br />
&gt; &gt; prepares off) is immune to...<br />
&gt; <br />
&gt; Try doing that with a real database ;)<br />
<br />
If PDO decided to use emulation by default (which has benefits like<br />
fewer roundtrips etc.) it's not necessarily the issue from the database.<br />
<br />
And that this doesn't work is obvious with emulation - PDO doesn't parse<br />
the SQL and has no understanding of &quot;SET NAMES&quot;, neither does the MySQL<br />
client lib used. The proper way to set the encoding is by using the<br />
DSN's charset option.<br />
<br />
johannes<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>Johannes Schlüter</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 11 Apr 2012 23:10:03 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,477342#msg-477342</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,477342#msg-477342</link>
            <description><![CDATA[ Anthony Ferrara wrote:<br />
&gt; Even with PDO and older versions of MySQL, you could inject into<br />
&gt; prepared statements quite easily (assuming charset settings):<br />
&gt;<br />
&gt; $var = '1' . chr(0xbf) . chr(0x27) . ' OR 1=1';<br />
&gt;<br />
&gt; $pdo = new PDO('mysql:...');<br />
&gt; $pdo-&gt;query('SET NAMES GBK');<br />
&gt; $stmt = $pdo-&gt;prepare('SELECT * FROM foo WHERE 2 = ?');<br />
&gt; $stmt-&gt;bindParam(1, $var);<br />
&gt; $stmt-&gt;execute();<br />
&gt;<br />
&gt; Without setting $pdo-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, 0)<br />
&gt; first, that will successfully inject into the query thanks to how PDO<br />
&gt; emulates prepares.<br />
&gt;<br />
&gt; A problem that true prepared statements (MySQLi and if PDO has emulate<br />
&gt; prepares off) is immune to...<br />
<br />
Try doing that with a real database ;)<br />
<br />
Firebird is not susceptible to this sort of problem. And I have still to find <br />
any use for PDO in real systems. It's just another layer that gets in the way of <br />
processing data securely. Emulating things half cocked is simply another <br />
security hole anyway.<br />
<br />
-- <br />
Lester Caine - G8HFL<br />
-----------------------------<br />
Contact - <a href="http://lsces.co.uk/wiki/?page=contact" target="_blank"  rel="nofollow">http://lsces.co.uk/wiki/?page=contact</a><br />
L.S.Caine Electronic Services - <a href="http://lsces.co.uk" target="_blank"  rel="nofollow">http://lsces.co.uk</a><br />
EnquirySolve - <a href="http://enquirysolve.com/" target="_blank"  rel="nofollow">http://enquirysolve.com/</a><br />
Model Engineers Digital Workshop - <a href="http://medw.co.uk//" target="_blank"  rel="nofollow">http://medw.co.uk//</a><br />
Firebird - <a href="http://www.firebirdsql.org/index.php" target="_blank"  rel="nofollow">http://www.firebirdsql.org/index.php</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>Lester Caine</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 11 Apr 2012 20:50:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,477287#msg-477287</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,477287#msg-477287</link>
            <description><![CDATA[ Lester,<br />
<br />
Even with PDO and older versions of MySQL, you could inject into<br />
prepared statements quite easily (assuming charset settings):<br />
<br />
$var = '1' . chr(0xbf) . chr(0x27) . ' OR 1=1';<br />
<br />
$pdo = new PDO('mysql:...');<br />
$pdo-&gt;query('SET NAMES GBK');<br />
$stmt = $pdo-&gt;prepare('SELECT * FROM foo WHERE 2 = ?');<br />
$stmt-&gt;bindParam(1, $var);<br />
$stmt-&gt;execute();<br />
<br />
Without setting $pdo-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, 0)<br />
first, that will successfully inject into the query thanks to how PDO<br />
emulates prepares.<br />
<br />
A problem that true prepared statements (MySQLi and if PDO has emulate<br />
prepares off) is immune to...<br />
<br />
Anthony<br />
<br />
On Wed, Apr 11, 2012 at 12:06 PM, Lester Caine &lt;lester@lsces.co.uk&gt; wrote:<br />
&gt; Ralph Schindler wrote:<br />
&gt;&gt;<br />
&gt;&gt; Hey Lester,<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;&gt; That is almost archaic it's self ...<br />
&gt;&gt;&gt; It should be replaced with a pointer to using parameters ( no we do not<br />
&gt;&gt;&gt; need 'prepared statements', just parameters ). One of the first things I<br />
&gt;&gt;&gt; implement on any code that I'm porting. Does away with any agro over<br />
&gt;&gt;&gt; escaping strings and is totally save 'injection' wise.<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; While I generally agree, 'just parameters' does have it's limitations.<br />
&gt;&gt; Sometimes<br />
&gt;&gt; there are special character sequences that can be exploited to escape out<br />
&gt;&gt; of a<br />
&gt;&gt; quoted value in a SQL string.<br />
&gt;&gt;<br />
&gt;&gt; Offhand, this comes to mind about MySQL:<br />
&gt;&gt; <a href="http://bugs.mysql.com/bug.php?id=8378" target="_blank"  rel="nofollow">http://bugs.mysql.com/bug.php?id=8378</a><br />
&gt;<br />
&gt;<br />
&gt; Well if you must use a simple database ;)<br />
&gt;<br />
&gt; I've never used MySQL simply because it has yet to get to the same standard<br />
&gt; as Firebird ... But I'm talking about passing parameters direct to '?'<br />
&gt; entries in the SQL - something which if it CAN be broken then the database<br />
&gt; is also broken? The database handles the 'data' going into a single field at<br />
&gt; a time.<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; Lester Caine - G8HFL<br />
&gt; -----------------------------<br />
&gt; Contact - <a href="http://lsces.co.uk/wiki/?page=contact" target="_blank"  rel="nofollow">http://lsces.co.uk/wiki/?page=contact</a><br />
&gt; L.S.Caine Electronic Services - <a href="http://lsces.co.uk" target="_blank"  rel="nofollow">http://lsces.co.uk</a><br />
&gt; EnquirySolve - <a href="http://enquirysolve.com/" target="_blank"  rel="nofollow">http://enquirysolve.com/</a><br />
&gt; Model Engineers Digital Workshop - <a href="http://medw.co.uk//" target="_blank"  rel="nofollow">http://medw.co.uk//</a><br />
&gt; Firebird - <a href="http://www.firebirdsql.org/index.php" target="_blank"  rel="nofollow">http://www.firebirdsql.org/index.php</a><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>Anthony Ferrara</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 11 Apr 2012 19:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,477231#msg-477231</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,477231#msg-477231</link>
            <description><![CDATA[ Ralph Schindler wrote:<br />
&gt; Hey Lester,<br />
&gt;<br />
&gt;&gt; That is almost archaic it's self ...<br />
&gt;&gt; It should be replaced with a pointer to using parameters ( no we do not<br />
&gt;&gt; need 'prepared statements', just parameters ). One of the first things I<br />
&gt;&gt; implement on any code that I'm porting. Does away with any agro over<br />
&gt;&gt; escaping strings and is totally save 'injection' wise.<br />
&gt;<br />
&gt; While I generally agree, 'just parameters' does have it's limitations. Sometimes<br />
&gt; there are special character sequences that can be exploited to escape out of a<br />
&gt; quoted value in a SQL string.<br />
&gt;<br />
&gt; Offhand, this comes to mind about MySQL:<br />
&gt; <a href="http://bugs.mysql.com/bug.php?id=8378" target="_blank"  rel="nofollow">http://bugs.mysql.com/bug.php?id=8378</a><br />
<br />
Well if you must use a simple database ;)<br />
<br />
I've never used MySQL simply because it has yet to get to the same standard as <br />
Firebird ... But I'm talking about passing parameters direct to '?' entries in <br />
the SQL - something which if it CAN be broken then the database is also broken? <br />
The database handles the 'data' going into a single field at a time.<br />
<br />
-- <br />
Lester Caine - G8HFL<br />
-----------------------------<br />
Contact - <a href="http://lsces.co.uk/wiki/?page=contact" target="_blank"  rel="nofollow">http://lsces.co.uk/wiki/?page=contact</a><br />
L.S.Caine Electronic Services - <a href="http://lsces.co.uk" target="_blank"  rel="nofollow">http://lsces.co.uk</a><br />
EnquirySolve - <a href="http://enquirysolve.com/" target="_blank"  rel="nofollow">http://enquirysolve.com/</a><br />
Model Engineers Digital Workshop - <a href="http://medw.co.uk//" target="_blank"  rel="nofollow">http://medw.co.uk//</a><br />
Firebird - <a href="http://www.firebirdsql.org/index.php" target="_blank"  rel="nofollow">http://www.firebirdsql.org/index.php</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>Lester Caine</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 11 Apr 2012 18:10:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,477213#msg-477213</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,477213#msg-477213</link>
            <description><![CDATA[ Hey Lester,<br />
<br />
On 4/11/12 3:29 AM, Lester Caine wrote:<br />
<br />
&gt; That is almost archaic it's self ...<br />
&gt; It should be replaced with a pointer to using parameters ( no we do not<br />
&gt; need 'prepared statements', just parameters ). One of the first things I<br />
&gt; implement on any code that I'm porting. Does away with any agro over<br />
&gt; escaping strings and is totally save 'injection' wise.<br />
<br />
While I generally agree, 'just parameters' does have it's limitations. <br />
Sometimes there are special character sequences that can be exploited to <br />
escape out of a quoted value in a SQL string.<br />
<br />
Offhand, this comes to mind about MySQL:<br />
<a href="http://bugs.mysql.com/bug.php?id=8378" target="_blank"  rel="nofollow">http://bugs.mysql.com/bug.php?id=8378</a><br />
<br />
-ralph<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>Ralph Schindler</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 11 Apr 2012 17:50:03 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,477199#msg-477199</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,477199#msg-477199</link>
            <description><![CDATA[ I do agree with a lot of what was being said. But what can you do?<br />
These are mostly quirks of the language. You learn to live with them.<br />
I don't make excuses for it. It is what it is.<br />
<br />
The only thing that infuriates me is the ternary operator being left<br />
associative. I want that fixed - screw bc on that one! I have been<br />
programming for 10 years and that one still confuses me! Most people<br />
just add parentheses to &quot;fix&quot; the problem. I wish someone would write<br />
an RFC to change this to right associative like every other language!<br />
*hint hint*<br />
<br />
Luke Scott<br />
<br />
On Apr 10, 2012, at 9:21 AM, Adir Kuhn &lt;adirkuhn@gmail.com&gt; wrote:<br />
<br />
&gt; Hi folks,<br />
&gt;<br />
&gt; today I read this post, I think that some points are valid, follow the link for<br />
&gt; you guys<br />
&gt;<br />
&gt; <a href="http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/" target="_blank"  rel="nofollow">http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/</a><br />
&gt;<br />
&gt; Adir Kuhn<br />
&gt; ZCE - Zend Certified Engineer **PHP 5.3 #ZEND004035<br />
&gt; PSMI - Professional Scrum Master I<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>Wed, 11 Apr 2012 17:30:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,477008#msg-477008</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,477008#msg-477008</link>
            <description><![CDATA[ Yasuo Ohgaki wrote:<br />
&gt; Anyway,<br />
&gt; <a href="http://www.php.net/manual/en/security.database.sql-injection.php" target="_blank"  rel="nofollow">http://www.php.net/manual/en/security.database.sql-injection.php</a><br />
&gt; I've never read this page. This page must be improved...<br />
<br />
That is almost archaic it's self ...<br />
It should be replaced with a pointer to using parameters ( no we do not need <br />
'prepared statements', just parameters ). One of the first things I implement on <br />
any code that I'm porting. Does away with any agro over escaping strings and is <br />
totally save 'injection' wise.<br />
<br />
-- <br />
Lester Caine - G8HFL<br />
-----------------------------<br />
Contact - <a href="http://lsces.co.uk/wiki/?page=contact" target="_blank"  rel="nofollow">http://lsces.co.uk/wiki/?page=contact</a><br />
L.S.Caine Electronic Services - <a href="http://lsces.co.uk" target="_blank"  rel="nofollow">http://lsces.co.uk</a><br />
EnquirySolve - <a href="http://enquirysolve.com/" target="_blank"  rel="nofollow">http://enquirysolve.com/</a><br />
Model Engineers Digital Workshop - <a href="http://medw.co.uk//" target="_blank"  rel="nofollow">http://medw.co.uk//</a><br />
Firebird - <a href="http://www.firebirdsql.org/index.php" target="_blank"  rel="nofollow">http://www.firebirdsql.org/index.php</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>Lester Caine</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 11 Apr 2012 10:40:03 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,476997#msg-476997</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,476997#msg-476997</link>
            <description><![CDATA[ Stopped reading after encountered &quot;E_ACTUALLY_ALL&quot;, &quot;for ($foo as &amp;$bar)&quot; -<br />
these things required me to google or to refer to docs to ensure I was not<br />
missing something. And, yes, I should have stopped after the words &quot;don’t<br />
tell me anything!&quot;. People who refuse to listen do not deserve to be heard.<br />
<br />
2012/4/11 Yasuo Ohgaki &lt;yohgaki@ohgaki.net&gt;<br />
<br />
&gt; Hi,<br />
&gt;<br />
&gt; It was fun to read. I understand he just don't like PHP.<br />
&gt; His article may be good for novice users to understand how PHP will behave.<br />
&gt;<br />
&gt; I guess he learned PHP a lot, but he lists framework feature as<br />
&gt; missing. I wander why. He seems to like Python, but Python's multibyte<br />
&gt; support was awful until recent.<br />
&gt;<br />
&gt; Anyway,<br />
&gt; <a href="http://www.php.net/manual/en/security.database.sql-injection.php" target="_blank"  rel="nofollow">http://www.php.net/manual/en/security.database.sql-injection.php</a><br />
&gt; I've never read this page. This page must be improved...<br />
&gt;<br />
&gt; I haven't read all, but there may be other places that may help.<br />
&gt;<br />
&gt; Regards,<br />
&gt;<br />
&gt; --<br />
&gt; Yasuo Ohgaki<br />
&gt; <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 />
&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;]]></description>
            <dc:creator>Crocodile</dc:creator>
            <category>php-internals</category>
            <pubDate>Wed, 11 Apr 2012 10:20:02 +0200</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,476594,476981#msg-476981</guid>
            <title>Re: [PHP-DEV] [off] PHP: a fractal of bad design</title>
            <link>http://www.serverphorums.com/read.php?7,476594,476981#msg-476981</link>
            <description><![CDATA[ Hi,<br />
<br />
It was fun to read. I understand he just don't like PHP.<br />
His article may be good for novice users to understand how PHP will behave.<br />
<br />
I guess he learned PHP a lot, but he lists framework feature as<br />
missing. I wander why. He seems to like Python, but Python's multibyte<br />
support was awful until recent.<br />
<br />
Anyway,<br />
<a href="http://www.php.net/manual/en/security.database.sql-injection.php" target="_blank"  rel="nofollow">http://www.php.net/manual/en/security.database.sql-injection.php</a><br />
I've never read this page. This page must be improved...<br />
<br />
I haven't read all, but there may be other places that may help.<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>Wed, 11 Apr 2012 09:40:02 +0200</pubDate>
        </item>
    </channel>
</rss>
