Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76719 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72369 invoked from network); 20 Aug 2014 09:13:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Aug 2014 09:13:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@mabe.berlin; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@mabe.berlin; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.171 cause and error) X-PHP-List-Original-Sender: php@mabe.berlin X-Host-Fingerprint: 80.237.132.171 wp164.webpack.hosteurope.de Received: from [80.237.132.171] ([80.237.132.171:35305] helo=wp164.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/60-03084-F9664F35 for ; Wed, 20 Aug 2014 05:13:04 -0400 Received: from dslc-082-082-189-238.pools.arcor-ip.net ([82.82.189.238] helo=[192.168.178.27]); authenticated by wp164.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1XK1wx-0000aD-4r; Wed, 20 Aug 2014 11:12:59 +0200 Message-ID: <53F46671.8020601@mabe.berlin> Date: Wed, 20 Aug 2014 11:12:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: =?UTF-8?B?Sm9oYW5uZXMgU2NobMO8dGVy?= , Tjerk Meesters CC: Sara Golemon , PHP internals References: <53F1094B.4040100@mabe.berlin> <53F1F534.50109@mabe.berlin> <1408373244.2617.344.camel@guybrush> <37CD1B56-B84F-4586-A631-F3C7F2547FBE@gmail.com> <1408375856.2617.353.camel@guybrush> <1408376583.2617.357.camel@guybrush> In-Reply-To: <1408376583.2617.357.camel@guybrush> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;php@mabe.berlin;1408525983;9d81a1fd; Subject: Re: [PHP-DEV] [RFC] Binary String Comparison From: php@mabe.berlin (Marc Bennewitz) On 18.08.2014 17:43, Johannes Schlüter wrote: > On Mon, 2014-08-18 at 17:30 +0200, Johannes Schlüter wrote: >> foreach ($db->query("SELECT id, title FROM entries") as $row) { >> echo "> if ($row[0] == $_GET['highlight_id']) { >> echo " background='#ff0000'"; >> } >> echo ">".htmlentities($row[1]).""; >> } >> >> will suddenly fail. How wonderful! (irony) > > Just to make this more fun: Assume $db is PDO then the behavior will > depend on the driver (and for some drivers even at the configuration, > i.e. setting of PDO::ATTR_EMULATE_PREPARES with MySQL) what will happen. I don't understand exactly what you mean here. This RFC has nothing todo with DB layer and PDO. Do you have any example where a DB returns integers differently? On your example the comparison only fails if the GET-variable is a non human formed integer means prefixing with a whitespace (but not suffixing), prefixing with a 0 or formed as a real number or hex. I'm very sure the changed behavior doesn't open big real life BC issues. I will run some testsuites on it. > > johannes > > >