Skip to content

Commit 67e3879

Browse files
committed
bug symfony#25823 [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage is used (giovannialbero1992)
This PR was merged into the 3.4 branch. Discussion ---------- [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage is used | Q | A | ------------- | --- | Branch? | master for features / 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#25742 | License | MIT | Doc PR | not requested Commits ------- 6aa2b7c [Security] Notify that symfony/expression-language is not installed if ExpressionLanguage and ExpressionLanguagePrivider are used
2 parents 6df7d83 + 6aa2b7c commit 67e3879

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/Symfony/Component/Security/Core/Authorization/ExpressionLanguage.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@
1313

1414
use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage;
1515

16-
/**
17-
* Adds some function to the default ExpressionLanguage.
18-
*
19-
* @author Fabien Potencier <fabien@symfony.com>
20-
*
21-
* @see ExpressionLanguageProvider
22-
*/
23-
class ExpressionLanguage extends BaseExpressionLanguage
24-
{
16+
if (!class_exists(BaseExpressionLanguage::class)) {
17+
throw new \LogicException(sprintf('The "%s" class requires the "ExpressionLanguage" component. Try running "composer require symfony/expression-language".', ExpressionLanguage::class));
18+
} else {
2519
/**
26-
* {@inheritdoc}
20+
* Adds some function to the default ExpressionLanguage.
21+
*
22+
* @author Fabien Potencier <fabien@symfony.com>
23+
*
24+
* @see ExpressionLanguageProvider
2725
*/
28-
public function __construct($cache = null, array $providers = array())
26+
class ExpressionLanguage extends BaseExpressionLanguage
2927
{
30-
// prepend the default provider to let users override it easily
31-
array_unshift($providers, new ExpressionLanguageProvider());
28+
/**
29+
* {@inheritdoc}
30+
*/
31+
public function __construct($cache = null, array $providers = array())
32+
{
33+
// prepend the default provider to let users override it easily
34+
array_unshift($providers, new ExpressionLanguageProvider());
3235

33-
parent::__construct($cache, $providers);
36+
parent::__construct($cache, $providers);
37+
}
3438
}
3539
}

0 commit comments

Comments
 (0)