Skip to content

Commit 1a69670

Browse files
[VarExporter] Fix possible memory-leak when using lazy-objects
1 parent bb32803 commit 1a69670

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

Dumper/PhpDumper.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
3030
use Symfony\Component\DependencyInjection\Exception\LogicException;
3131
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
32-
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
3332
use Symfony\Component\DependencyInjection\ExpressionLanguage;
3433
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface as ProxyDumper;
3534
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\LazyServiceDumper;
@@ -168,15 +167,7 @@ public function dump(array $options = []): string|array
168167

169168
if ($this->getProxyDumper() instanceof NullDumper) {
170169
(new AnalyzeServiceReferencesPass(true, false))->process($this->container);
171-
try {
172-
(new CheckCircularReferencesPass())->process($this->container);
173-
} catch (ServiceCircularReferenceException $e) {
174-
$path = $e->getPath();
175-
end($path);
176-
$path[key($path)] .= '". Try running "composer require symfony/proxy-manager-bridge';
177-
178-
throw new ServiceCircularReferenceException($e->getServiceId(), $path);
179-
}
170+
(new CheckCircularReferencesPass())->process($this->container);
180171
}
181172

182173
$this->analyzeReferences();

Tests/Dumper/PhpDumperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ public function testCircularReferenceAllowanceForLazyServices()
765765
$dumper = new PhpDumper($container);
766766
$dumper->setProxyDumper(new NullDumper());
767767

768-
$message = 'Circular reference detected for service "foo", path: "foo -> bar -> foo". Try running "composer require symfony/proxy-manager-bridge".';
768+
$message = 'Circular reference detected for service "foo", path: "foo -> bar -> foo".';
769769
$this->expectException(ServiceCircularReferenceException::class);
770770
$this->expectExceptionMessage($message);
771771

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"symfony/yaml": "",
3232
"symfony/config": "",
3333
"symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required",
34-
"symfony/expression-language": "For using expressions in service container configuration",
35-
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them"
34+
"symfony/expression-language": "For using expressions in service container configuration"
3635
},
3736
"conflict": {
3837
"ext-psr": "<1.1|>=2",

0 commit comments

Comments
 (0)