From 7b6bf7a3e03b0d39cd90f7b056b35fbf4bd6ef96 Mon Sep 17 00:00:00 2001 From: Michael Grosse <grosse@cosmocode.de> Date: Fri, 10 Feb 2017 15:59:05 +0100 Subject: [PATCH] Fix strict warnings in optgroups/dropdowns PHP 5.6 and below throw a strict standards warning at the changed lines. An intermediate variable is introduced to avoid this warning. PHP 7+ changes the severity of this warning to E_NOTICE which is suppressed by DokuWiki. This error was introduced in #1778 --- inc/Form/DropdownElement.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/Form/DropdownElement.php b/inc/Form/DropdownElement.php index 29f94675b..023b67dd3 100644 --- a/inc/Form/DropdownElement.php +++ b/inc/Form/DropdownElement.php @@ -142,12 +142,14 @@ class DropdownElement extends InputElement { protected function getFirstOption() { $options = $this->options(); if (!empty($options)) { - return (string) array_shift(array_keys($options)); + $keys = array_keys($options); + return (string) array_shift($keys); } foreach ($this->optGroups as $optGroup) { $options = $optGroup->options(); if (!empty($options)) { - return (string) array_shift(array_keys($options)); + $keys = array_keys($options); + return (string) array_shift($keys); } } } -- GitLab