Merge branch '2.x' into 3.x

* 2.x:
  Fix tests
  Updates CoreExtension::twig_constant to check for definition first to avoid hard crash
This commit is contained in:
Fabien Potencier
2022-12-26 16:12:53 +01:00
2 changed files with 6 additions and 2 deletions
@@ -15,10 +15,10 @@
return [];
--EXPECT--
Aug 7, 2019, 11:39:12 PM
7 août 2019 à 23:39:12
7 août 2019, 23:39:12
23:39
07/08/2019
mercredi 7 août 2019 à 23:39:12 Temps universel coordonné
mercredi 7 août 2019 à 23:39:12 temps universel coordonné
11 oclock PM, Coordinated Universal Time
Aug 7, 2019
+4
View File
@@ -1366,6 +1366,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);
}