Re: [RFC] Binary String Comparison
| From: | Marc Bennewitz | Date: | Wed, 20 Aug 2014 09:12:17 +0000 |
| Subject: | Re: [RFC] Binary String Comparison | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76719@lists.php.net to get a copy of this message | ||
On 18.08.2014 17:43, Johannes Schlüter wrote:
On Mon, 2014-08-18 at 17:30 +0200, Johannes Schlüter wrote: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.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.foreach ($db->query("SELECT id, title FROM entries") as $row) { echo "<tr><td"; if ($row[0] == $_GET['highlight_id']) { echo " background='#ff0000'"; } echo ">".htmlentities($row[1])."</td></tr>"; }will suddenly fail. How wonderful! (irony)
johannes