From a2ba03849f3adefa745838bff626c8304eb3d8c7 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Mon, 20 Jan 2020 09:48:53 +0800 Subject: [PATCH] Fix PHP 7.4 deprecations --- inc/lib/IP/Lifo/IP/BC.php | 8 ++++---- inc/lib/Twig/Node.php | 4 ++-- inc/lib/Twig/Template.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/inc/lib/IP/Lifo/IP/BC.php b/inc/lib/IP/Lifo/IP/BC.php index 545fe372..26a2c2b7 100755 --- a/inc/lib/IP/Lifo/IP/BC.php +++ b/inc/lib/IP/Lifo/IP/BC.php @@ -102,7 +102,7 @@ abstract class BC $value = ''; for ($i=0; $i<$len; $i++) { - $value .= (($left{$i} + 0) & ($right{$i} + 0)) ? '1' : '0'; + $value .= (($left[$i] + 0) & ($right[$i] + 0)) ? '1' : '0'; } return self::bcbindec($value != '' ? $value : '0'); } @@ -116,7 +116,7 @@ abstract class BC $value = ''; for ($i=0; $i<$len; $i++) { - $value .= (($left{$i} + 0) | ($right{$i} + 0)) ? '1' : '0'; + $value .= (($left[$i] + 0) | ($right[$i] + 0)) ? '1' : '0'; } return self::bcbindec($value != '' ? $value : '0'); } @@ -130,7 +130,7 @@ abstract class BC $value = ''; for ($i=0; $i<$len; $i++) { - $value .= (($left{$i} + 0) ^ ($right{$i} + 0)) ? '1' : '0'; + $value .= (($left[$i] + 0) ^ ($right[$i] + 0)) ? '1' : '0'; } return self::bcbindec($value != '' ? $value : '0'); } @@ -144,7 +144,7 @@ abstract class BC $len = self::_bitwise($left, $right, $bits); $value = ''; for ($i=0; $i<$len; $i++) { - $value .= $left{$i} == '1' ? '0' : '1'; + $value .= $left[$i] == '1' ? '0' : '1'; } return self::bcbindec($value); } diff --git a/inc/lib/Twig/Node.php b/inc/lib/Twig/Node.php index 89ada144..0635aae0 100644 --- a/inc/lib/Twig/Node.php +++ b/inc/lib/Twig/Node.php @@ -39,7 +39,7 @@ class Twig_Node implements Twig_NodeInterface { foreach ($nodes as $name => $node) { if (!$node instanceof Twig_NodeInterface) { - @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED); + @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', (is_object($node) ? get_class($node) : null) === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED); } } $this->nodes = $nodes; @@ -195,7 +195,7 @@ class Twig_Node implements Twig_NodeInterface public function setNode($name, $node = null) { if (!$node instanceof Twig_NodeInterface) { - @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', is_object($node) ? get_class($node) : null === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED); + @trigger_error(sprintf('Using "%s" for the value of node "%s" of "%s" is deprecated since version 1.25 and will be removed in 2.0.', (is_object($node) ? get_class($node) : null) === $node ? 'null' : gettype($node), $name, get_class($this)), E_USER_DEPRECATED); } $this->nodes[$name] = $node; diff --git a/inc/lib/Twig/Template.php b/inc/lib/Twig/Template.php index 3709232a..c013b6a2 100644 --- a/inc/lib/Twig/Template.php +++ b/inc/lib/Twig/Template.php @@ -579,7 +579,7 @@ abstract class Twig_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) || property_exists($object, (string) $item)) { if ($isDefinedTest) { return true; }