freetag 3.70.4: Prevent illegal offset error

See https://board.s9y.org/viewtopic.php?f=10&t=25398
This commit is contained in:
onli 2021-11-27 21:07:11 +01:00
parent 10cb326881
commit c778b6f0cf
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,5 @@
3.70.4: Fix a situation when an illegal offset error could occur
3.70.3: Hotfixes for PHP 8 (surrim) 3.70.3: Hotfixes for PHP 8 (surrim)
3.70.2: Fix warning in RSS feed when using PHP 8 3.70.2: Fix warning in RSS feed when using PHP 8

View file

@ -66,7 +66,7 @@ class serendipity_event_freetag extends serendipity_event
'smarty' => '2.6.7', 'smarty' => '2.6.7',
'php' => '7.0' 'php' => '7.0'
)); ));
$propbag->add('version', '3.70.3'); $propbag->add('version', '3.70.4');
$propbag->add('event_hooks', array( $propbag->add('event_hooks', array(
'frontend_fetchentries' => true, 'frontend_fetchentries' => true,
'frontend_fetchentry' => true, 'frontend_fetchentry' => true,
@ -1548,7 +1548,11 @@ addLoadEvent(enableAutocomplete);
} }
} }
} }
unset($tags[$tag]); // Check that $tag is a valid value to prevent the 'illegal offset error' that will occur
// on real traffic patterns (unclear on which page exactly)
if ($tag != null && is_string($tag) && isset($tags[$tag])) {
unset($tags[$tag]);
}
return $tags; return $tags;
} }