Re: [RFC] Binary String Comparison
| From: | Julien Pauli | Date: | Mon, 18 Aug 2014 09:57:53 +0000 |
| Subject: | Re: [RFC] Binary String Comparison | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76639@lists.php.net to get a copy of this message | ||
On Sun, Aug 17, 2014 at 9:58 PM, Marc Bennewitz <php@mabe.berlin> wrote:
> Hi internals!
>
> 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
>
> On comparing two numeric strings both operands will be equal if the string
> representation will be the same. On comparing two numeric strings the first
> operand will be greater if the first not matching byte will be higher. On
> comparing two numeric strings the first operand will be lower if the first
> not matching byte will be lower.
>
> As a side effect it makes string comparison much faster and force developer
> to really write what they mean (No need to guess) and to force developers to
> cast/filter input once which also affects performance.
>
> On C-Level the function zendi_smart_strcmp will be unused and marked as
> deprecated.
>
> Thanks,
> Marc
This seems to me as a major breakage, not necessary, as strict
comparison (===) or strcmp() are available.
Julien Pauli