Skip to content

Commit d820d50

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 83d0106 + fcb11c7 commit d820d50

File tree

9 files changed

+28
-4
lines changed

9 files changed

+28
-4
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public function dump(array $options = []): string|array
258258
<?php
259259
260260
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
261+
use Symfony\Component\DependencyInjection\ContainerInterface;
261262
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
262263
263264
/*{$this->docStar}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10_as_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ return [
1313
namespace Container%s;
1414

1515
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
16+
use Symfony\Component\DependencyInjection\ContainerInterface;
1617
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1718

1819
/**

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ return [
2323
namespace Container%s;
2424

2525
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
26+
use Symfony\Component\DependencyInjection\ContainerInterface;
2627
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
2728

2829
/**

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_deprecated_parameters_as_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Array
55
namespace Container%s;
66

77
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
8+
use Symfony\Component\DependencyInjection\ContainerInterface;
89
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
910

1011
/**

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_non_shared_lazy_as_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Array
55
namespace Container%s;
66

77
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
8+
use Symfony\Component\DependencyInjection\ContainerInterface;
89
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
910

1011
/**

src/Symfony/Component/Routing/RouteCollection.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,15 @@ public function get(string $name): ?Route
147147
*/
148148
public function remove(string|array $name)
149149
{
150-
foreach ((array) $name as $n) {
151-
unset($this->routes[$n], $this->priorities[$n], $this->aliases[$n]);
150+
$names = (array) $name;
151+
foreach ($names as $n) {
152+
unset($this->routes[$n], $this->priorities[$n]);
153+
}
154+
155+
foreach ($this->aliases as $k => $alias) {
156+
if (\in_array($alias->getId(), $names, true)) {
157+
unset($this->aliases[$k]);
158+
}
152159
}
153160
}
154161

src/Symfony/Component/Routing/Tests/RouteCollectionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,13 @@ public function testRemove()
225225
$collection1->add('bar', $bar = new Route('/bar'));
226226
$collection->addCollection($collection1);
227227
$collection->add('last', $last = new Route('/last'));
228+
$collection->addAlias('ccc_my_custom_alias', 'foo');
228229

229230
$collection->remove('foo');
230231
$this->assertSame(['bar' => $bar, 'last' => $last], $collection->all(), '->remove() can remove a single route');
231232
$collection->remove(['bar', 'last']);
232233
$this->assertSame([], $collection->all(), '->remove() accepts an array and can remove multiple routes at once');
234+
$this->assertNull($collection->getAlias('ccc_my_custom_alias'));
233235
}
234236

235237
public function testSetHost()

src/Symfony/Component/VarExporter/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
}

src/Symfony/Component/VarExporter/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)