Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76660 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72882 invoked from network); 18 Aug 2014 15:32:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Aug 2014 15:32:09 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:35219] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0F/E2-54989-77C12F35 for ; Mon, 18 Aug 2014 11:32:09 -0400 Received: by mail.experimentalworks.net (Postfix, from userid 1003) id 2C0B041B3A; Mon, 18 Aug 2014 17:32:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on km31408.keymachine.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.2 X-Spam-HAM-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Received: from [192.168.2.31] (ppp-93-104-0-106.dynamic.mnet-online.de [93.104.0.106]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id E076541B39; Mon, 18 Aug 2014 17:32:10 +0200 (CEST) To: Tjerk Meesters Cc: Marc Bennewitz , Sara Golemon , PHP internals In-Reply-To: <37CD1B56-B84F-4586-A631-F3C7F2547FBE@gmail.com> References: <53F1094B.4040100@mabe.berlin> <53F1F534.50109@mabe.berlin> <1408373244.2617.344.camel@guybrush> <37CD1B56-B84F-4586-A631-F3C7F2547FBE@gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Mon, 18 Aug 2014 17:30:56 +0200 Message-ID: <1408375856.2617.353.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Binary String Comparison From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Mon, 2014-08-18 at 23:09 +0800, Tjerk Meesters wrote: > > On 18 Aug, 2014, at 10:47 pm, Johannes Schlüter wrote: > > > >> On Mon, 2014-08-18 at 14:44 +0200, Marc Bennewitz wrote: > >> The question isn't "What's wrong with ===, strcmp()?" but "What's wrong > >> with ==, <, >?". > >> > >> We have a standard way to compare two operands but currently we do some > >> magic things to solve something that don't need to be solved. > > > > Still it is a key property of the language which we can't simply change. > > Also mind this: All input data are strings and some databases also > > return data as string. So code like > > > > if ($_GET['id'] > 0) > > or > > if ($db->fetchRow()[0] == 12) > > > > which is common will break. > > Those two cases will actually not be affected, it's strictly string<=>string comparisons that's being discussed here. Meaning that simple code you find everywhere, in every second tutorial foreach ($db->query("SELECT id, title FROM entries") as $row) { echo "".htmlentities($row[1]).""; } will suddenly fail. How wonderful! (irony) johannes ps. yes, the example might be done nicer and better, it still represents a common pattern.