From 31fb27e8d88a1ad51ce1dbdeb5845054e14262bb Mon Sep 17 00:00:00 2001 From: toxyy Date: Mon, 4 Dec 2023 15:31:13 -0500 Subject: [PATCH] [ticket/15214] Move setting $priority_key to a more appropriate place It doesn't need to be set at the top and makes more sense to set it at the bottom where it's used. Also removes a redundant check PHPBB3-15214 --- phpBB/phpbb/template/twig/node/event.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php index c3700459f0..9276efaa90 100644 --- a/phpBB/phpbb/template/twig/node/event.php +++ b/phpBB/phpbb/template/twig/node/event.php @@ -52,11 +52,6 @@ class event extends \Twig\Node\Node { $ext_namespace = str_replace('/', '_', $ext_namespace); - if (isset($this->template_event_priority_array[$ext_namespace][$location])) - { - $priority_key = $this->template_event_priority_array[$ext_namespace][$location]; - } - $compiler_calls = []; if ($this->environment->isDebug()) @@ -99,8 +94,10 @@ class event extends \Twig\Node\Node if (!empty($compiler_calls)) { - if (isset($priority_key)) + if (isset($this->template_event_priority_array[$ext_namespace][$location])) { + $priority_key = $this->template_event_priority_array[$ext_namespace][$location]; + if (array_key_exists($priority_key, $compiler_steps)) { array_splice($compiler_steps, $priority_key, 0, [$compiler_calls]);