Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c2091b5

Browse filesBrowse files
[VarExporter] Fix lazy ghost trait when using nullsafe operator
1 parent 0db5e7e commit c2091b5
Copy full SHA for c2091b5

File tree

Expand file treeCollapse file tree

2 files changed

+12
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-2
lines changed

‎src/Symfony/Component/VarExporter/LazyGhostTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarExporter/LazyGhostTrait.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@ public function &__get($name): mixed
175175
if ($state && (null === $scope || isset($propertyScopes["\0$scope\0$name"]))) {
176176
if (LazyObjectState::STATUS_INITIALIZED_FULL === $state->status) {
177177
// Work around php/php-src#12695
178-
$property = $propertyScopes[null === $scope ? $name : "\0$scope\0$name"][3]
179-
?? (Hydrator::$propertyScopes[$this::class] = Hydrator::getPropertyScopes($this::class))[3];
178+
$property = null === $scope ? $name : "\0$scope\0$name";
179+
$property = $propertyScopes[$property][3]
180+
?? (Hydrator::$propertyScopes[$this::class] = Hydrator::getPropertyScopes($this::class))[$property][3];
180181
} else {
181182
$property = null;
182183
}

‎src/Symfony/Component/VarExporter/Tests/Fixtures/LazyGhost/ChildMagicClass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarExporter/Tests/Fixtures/LazyGhost/ChildMagicClass.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,14 @@ class ChildMagicClass extends MagicClass implements LazyObjectInterface
1818
{
1919
use LazyGhostTrait;
2020

21+
private const LAZY_OBJECT_PROPERTY_SCOPES = [
22+
"\0".self::class."\0".'data' => [self::class, 'data', null],
23+
"\0".self::class."\0".'lazyObjectState' => [self::class, 'lazyObjectState', null],
24+
"\0".'Symfony\\Component\\VarExporter\\Tests\\Fixtures\\LazyGhost\\MagicClass'."\0".'data' => ['Symfony\\Component\\VarExporter\\Tests\\Fixtures\\LazyGhost\\MagicClass', 'data', null],
25+
'cloneCounter' => [self::class, 'cloneCounter', null],
26+
'data' => [self::class, 'data', null],
27+
'lazyObjectState' => [self::class, 'lazyObjectState', null],
28+
];
29+
2130
private int $data = 123;
2231
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.