On Wed, Mar 3, 2021 at 3:04 PM Nikita Popov <nikita....@gmail.com> wrote:
> Hi internals, > > PHP's == comparison semantics for strings have a peculiar edge-case, where > comparisons of the form "0e123" == "0e456" return true, because they are > interpreted as floating point zero numbers. This is problematic, because > strings of that form are usually not numbers, but hex-encoded hashes or > similar. > > I'm wondering if it may make sense to special-case the comparison > semantics to not consider strings of the form "0e[DIGITS]" equal, unless > they are exactly equal (i.e., fall back to lexicographical if both sides of > the comparison are zero exponentials). > > Here's a possible implementation: https://github.com/php/php-src/pull/6749 > > Of course, the usual rule that you should always use === still holds, but > this at least eliminates the most dangerous edge case. > So, I gather the consensus here is that we should leave this alone as a lost cause? Regards, Nikita