Order of properties in (array) cast on PHP 8.1
| From: | Benjamin Morel | Date: | Wed, 13 Oct 2021 21:45:13 +0000 |
| Subject: | Order of properties in (array) cast on PHP 8.1 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-116274@lists.php.net to get a copy of this message | ||
Hi internals,
While running the test suite of one of my libs against PHP 8.1, I noticed
that the order in which properties are returned in an (array) cast has
changed.
For example when casting an instance of this class to array:
class A
{
private $x = 'x';
}
class B extends A
{
public $y;
public $z;
}
On PHP 7.4-8.0, $x is returned last, while on PHP 8.1, it is returned first..
Demo: https://3v4l.org/FTMki
It's not a big deal, but before I change my test suites, I wanted to double
check here if this change was expected?
Thanks in advance,
— Benjamin