Re: The curious case of the comparable objects.
| From: | Sara Golemon | Date: | Sat, 11 Aug 2018 15:38:42 +0000 |
| Subject: | Re: The curious case of the comparable objects. | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103082@lists.php.net to get a copy of this message | ||
On Sat, Aug 11, 2018 at 8:34 AM, Christoph M. Becker <cmbecker69@gmx.de> wrote:
>> 2. Is it a bug introduced in 5.4 that's okay to fix? Or would fixing
>> it count as a BC break due to how long it's been broken? (I say
>> fixable bug, the BC break was at 5.4)
>
> I tend to agree, even though the behavior is not really documented. The
> php.net manual says nothing about the ordering of objects, and the
> language specification isn't clear about that, since it refers to array
> comparison[1], but doesn't define the order of the properties. Are
> properties of parent classes inserted before the properties of child
> classes? Are ad-hoc properties inserted after the predefined ones? Are
> trait properties inserted where the are “use”d? Are invisible
> properties also part of the comparison?
>
> [1]
>
> <https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#user-content-relational-operators>
>
Yeah, that's why I'm hesitant on just slapping a bug fix on it and
apply to 7.1+ without asking for input. If this were a younger
regression I might just do it and move on, but 5.4-7.2 is a six
release branches.
FWIW, objects with ad-hoc properties are not impacted by this since
they automatically have a HashTable for their properties. This only
impacts fully defined classes (the best kind) who have not had their
shadow table materialized (also the best kind).
PR, by the way: https://github.com/php/php-src/pull/3434
-Sara