Re: [RFC] Binary String Comparison

From: Date: Sun, 17 Aug 2014 20:47:12 +0000
Subject: Re: [RFC] Binary String Comparison
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-76615@lists.php.net to get a copy of this message
On 8/17/14, 1:18 PM, Sara Golemon wrote: > On Sun, Aug 17, 2014 at 12:58 PM, Marc Bennewitz <php@mabe.berlin> wrote: >> I've created a draft RFC and patch to change the behavior of non-strict >> string to string comparison to be binary safe (as the strict comparison >> operator does): >> >> https://wiki.php.net/rfc/binary_string_comparison >> > If I understand your goal correctly, you seem to want to change a very > fundamental (and ancient) behavior of the language even though > mechanisms already exist to do what you describe as the "changed > behavior". > > What exactly is wrong with ===, strcmp(), etc..? Yes, this would be a very problematic change at this point. It isn't something you could audit your code for easily and make it future-proof. Something that used to work will simply not and it will be nearly impossible to understand why. I don't necessarily disagree that this is perhaps the way it should have worked from the beginning, but without an upgrade path I don't think we can do this. The only mention in your RFC towards this is: This can be easily resolved by explicitly casting one of the operands to an integer or float respectively define the sorting algorithm." That is not an upgrade path. Going through and auditing every single comparison in a large code base to see if one side should perhaps be cast to a different type is not feasible. -Rasmus

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#76615) next »