Skip to content

Commit

Permalink
Fix strict warnings in optgroups/dropdowns
Browse files Browse the repository at this point in the history
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
  • Loading branch information
micgro42 committed Feb 10, 2017
1 parent 9c5f311 commit 7b6bf7a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inc/Form/DropdownElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ public function val($value = null) {
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);
}
}
}
Expand Down

0 comments on commit 7b6bf7a

Please sign in to comment.