mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-03 22:17:36 +00:00
Fix using array_key_exists() on objects, it is deprecated in PHP 7.4
This commit is contained in:
+2
-2
@@ -537,7 +537,7 @@ abstract class Template implements \Twig_TemplateInterface
|
||||
if (self::METHOD_CALL !== $type) {
|
||||
$arrayItem = \is_bool($item) || \is_float($item) ? (int) $item : $item;
|
||||
|
||||
if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, $object)))
|
||||
if (((\is_array($object) || $object instanceof \ArrayObject) && (isset($object[$arrayItem]) || \array_key_exists($arrayItem, (array) $object)))
|
||||
|| ($object instanceof \ArrayAccess && isset($object[$arrayItem]))
|
||||
) {
|
||||
if ($isDefinedTest) {
|
||||
@@ -604,7 +604,7 @@ abstract class Template implements \Twig_TemplateInterface
|
||||
|
||||
// object property
|
||||
if (self::METHOD_CALL !== $type && !$object instanceof self) { // \Twig\Template does not have public properties, and we don't want to allow access to internal ones
|
||||
if (isset($object->$item) || \array_key_exists((string) $item, $object)) {
|
||||
if (isset($object->$item) || \array_key_exists((string) $item, (array) $object)) {
|
||||
if ($isDefinedTest) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user