mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-01 13:07:22 +00:00
Updates CoreExtension::twig_constant to check for definition first to avoid hard crash
This commit is contained in:
committed by
Fabien Potencier
parent
0986e54682
commit
56b31224bd
@@ -1329,6 +1329,10 @@ function twig_constant($constant, $object = null)
|
||||
$constant = \get_class($object).'::'.$constant;
|
||||
}
|
||||
|
||||
if (!\defined($constant)) {
|
||||
throw new RuntimeError(sprintf('Constant "%s" is undefined.', $constant));
|
||||
}
|
||||
|
||||
return \constant($constant);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user