Skip to content

Commit 43c024a

Browse files
[Security] Notify that symfony/expression-language is not installed if ExpressionLanguage and ExpressionLanguagePrivider are used
1 parent 3b1d5ee commit 43c024a

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

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 <[email protected]>
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 <[email protected]>
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)