Skip to content

Commit 247f0f9

Browse files
committed
More bullet-proof expression evaluation
In some scenarios evaluating expression can lead to TypeError (unresolved DI params being strings, not expected integers etc).
1 parent 594cdf6 commit 247f0f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private function checkType(Definition $checkedDefinition, mixed $value, \Reflect
231231
} elseif ($value instanceof Expression) {
232232
try {
233233
$value = $this->getExpressionLanguage()->evaluate($value, ['container' => $this->container]);
234-
} catch (\Exception) {
234+
} catch (\Throwable) {
235235
// If a service from the expression cannot be fetched from the container, we skip the validation.
236236
return;
237237
}
@@ -246,7 +246,7 @@ private function checkType(Definition $checkedDefinition, mixed $value, \Reflect
246246
if ('' === preg_replace('/'.$envPlaceholderUniquePrefix.'_\w+_[a-f0-9]{32}/U', '', $value, -1, $c) && 1 === $c) {
247247
try {
248248
$value = $this->container->resolveEnvPlaceholders($value, true);
249-
} catch (\Exception) {
249+
} catch (\Throwable) {
250250
// If an env placeholder cannot be resolved, we skip the validation.
251251
return;
252252
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy