Re: Don't compare zero exponentials in strings as equal

From: Date: Wed, 03 Mar 2021 19:30:38 +0000
Subject: Re: Don't compare zero exponentials in strings as equal
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-113356@lists.php.net to get a copy of this message
Am 03.03.2021 um 19:21 schrieb Stanislav Malyshev <smalyshev@gmail.com>:
> Nobody who applies == to strings and expects it to work out as stri g comparison is doing the
> right thing. If you apply == to hex-encoded hashes, that code is fubar, and fixing one particular
> corner case won't rescue it. So I wonder if fixing one particular corner case while leaving
> many others in would do much.


Just brainstorming, but following that logic, if we would like to remedy this in the long run:
a) Should == with two strings where one (or both?) of them is numeric cause an E_NOTICE or E_WARNING
that === should be used?
b) Should == with two strings leave them as string? Possibly after a period of notice/warning as
described in a)?

I haven't really thought this through but I still wanted to throw it out there.
I'm sure you'll tell me how foolish I am and why this is a very bad idea ;-)

- Chris


Thread (16 messages)

« previous php.internals (#113356) next »