Skip to content

Commit 2d08ca6

Browse files
committed
Merge branch '6.3' into 6.4
* 6.3: [DependencyInjection] Fix dumping containers with null-referenced services [Routing] Fix removing aliases pointing to removed route in RouteCollection::remove() [VarExporter] Fix lazy ghost trait when using nullsafe operator
2 parents d6081c0 + 7bfcf23 commit 2d08ca6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

LazyGhostTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ public function &__get($name): mixed
166166
if ($state && (null === $scope || isset($propertyScopes["\0$scope\0$name"]))) {
167167
if (LazyObjectState::STATUS_INITIALIZED_FULL === $state->status) {
168168
// Work around php/php-src#12695
169-
$property = $propertyScopes[null === $scope ? $name : "\0$scope\0$name"][3]
170-
?? (Hydrator::$propertyScopes[$this::class] = Hydrator::getPropertyScopes($this::class))[3];
169+
$property = null === $scope ? $name : "\0$scope\0$name";
170+
$property = $propertyScopes[$property][3]
171+
?? Hydrator::$propertyScopes[$this::class][$property][3] = new \ReflectionProperty($scope ?? $class, $name);
171172
} else {
172173
$property = null;
173174
}

Tests/Fixtures/LazyGhost/ChildMagicClass.php

Lines 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".parent::class."\0".'data' => [parent::class, '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)