Re: Re: The curious case of the comparable objects.

From: Date: Sun, 12 Aug 2018 16:43:05 +0000
Subject: Re: Re: The curious case of the comparable objects.
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-103086@lists.php.net to get a copy of this message
On Sun, Aug 12, 2018 at 12:47 AM, Stanislav Malyshev <smalyshev@gmail.com> wrote: > Undefined behavior is undefined :) > (Ignoring your followup for a moment) Even for undefined behavior, we should *try* to make the behavior repeatable. I know we wouldn't need to, but we should always go for least surprise. It's the side-effect hiding in the array cast from print_r/var_dump or certain other presumable "read-only" actions causing the interpretation of of the object compare that's maximum surprise. >> >> <https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#user-content-relational-operators> > > So looks like this part of the spec is violated, and I stand corrected - > it's actually defined in this case, and should be fixed to follow the > spec. I still think it makes little sense, but we have the spec, so we > have to follow the spec. > > In this case, it's ok to fix it in all active versions - the spec wins I > think. Or, we have to change the spec :) > Personally, I vote for fix on active branches, but it's not an urgent bug, so I'll give some more time for feedback before pushing the PR below. > Depends on what the "fix" is, I assume. > I went with https://github.com/php/php-src/pull/3434 which has the same overall complexity, though several more operations per element so it'll be nominally less performant. Alternate implementations welcome. -Sara

« previous php.internals (#103086) next »