Skip to content

Commit 12f3e37

Browse files
minor #41627 [VarExporter] Fix test on PHP 8.1 (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- [VarExporter] Fix test on PHP 8.1 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Part of #41552 | License | MIT | Doc PR | N/A On PHP 8.1, when dumping the properties of an object (either through serialization, `var_dump` or an array cast), those properties might appear in a different order than on PHP 8.0 and earlier. Because of that, the test I'm fixing here fails. Since the order of the properties is not really important, I'm sorting the dumped array by key in order to get a stable order. Commits ------- 56359cb [VarExporter] Fix test on PHP 8.1
2 parents 7445c3e + 56359cb commit 12f3e37

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Symfony/Component/VarExporter/Tests/InstantiatorTest.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ public function testInstantiate()
5555
"\0".__NAMESPACE__."\Foo\0priv" => 234,
5656
];
5757

58-
$this->assertSame($expected, (array) Instantiator::instantiate(Bar::class, ['priv' => 123], [Foo::class => ['priv' => 234]]));
58+
$actual = (array) Instantiator::instantiate(Bar::class, ['priv' => 123], [Foo::class => ['priv' => 234]]);
59+
ksort($actual);
60+
61+
$this->assertSame($expected, $actual);
5962

6063
$e = Instantiator::instantiate('Exception', ['foo' => 123, 'trace' => [234]]);
6164

0 commit comments

Comments
 (0)