PHP Warning: foreach() argument must be of type array|object, null given
-
Getting these warnings in
debug.log
[18-Jan-2025 16:33:48 UTC] PHP Warning: foreach() argument must be of type array|object, null given in .../wp-content/plugins/event-post/eventpost.php on line 798
[18-Jan-2025 16:33:48 UTC] PHP Warning: Trying to access array offset on value of type null in .../wp-content/plugins/event-post/eventpost.php on line 808
[18-Jan-2025 16:33:48 UTC] PHP Warning: Trying to access array offset on value of type null in .../wp-content/plugins/event-post/eventpost.php on line 809Current code:
797: $maps = $this->maps;
798: foreach($maps as $m=>$map){
...
804: }
805: wp_add_inline_script('event-post', 'var EventPost = EventPost || {}; EventPost.front='.wp_json_encode(array(
806: 'imgpath' => plugins_url('/img/', __FILE__),
807: 'maptiles' => $maps,
808: 'defaulttile' => $this->settings['tile'],
809: 'zoom' => $this->settings['zoom'],
...
812: )), 'before');A fix could be similar to this:
$maps = $this->maps;
if ( !empty( $maps ) ) {
foreach($maps as $m=>$map){
...
}
wp_add_inline_script('event-post', ...
...
)), 'before');
}Event post 5.9.8, WordPress 6.4.5
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.