PHP Warning: Invalid argument supplied for foreach() - gantry plugin - php

I got this error log few days ago
PHP Warning: Invalid argument supplied for foreach() in /home/karatm/public_html/wp-content/plugins/gantry/bugfixes.php on line 52<br>
PHP Warning: Invalid argument supplied for foreach() in /home/karatm/public_html/wp-content/plugins/gantry/bugfixes.php on line 52<br>
PHP Warning: Invalid argument supplied for foreach() in /home/karatm/public_html/wp-content/plugins/gantry/bugfixes.php on line 102<br>
This is line 52 from bugfixes.php:
foreach($sidebar_contents as $sidebar_contents_id => &$sidebar_widget_instance)
This is line 102 from bugfixes.php:
foreach ($override_sidebar as $position => &$sbw_instances)
What this error mean, how can i fix this ?
(if someone can help me, i can send him the full .php file)
Thanks

foreach ($override_sidebar as $position => &$sbw_instances)
try to remove &
try this
foreach ($override_sidebar as $position => $sbw_instances)

Related

why have I an error in the visual constructor?

I have an error notice in the visual constructor of my web page (jupiter)
That error says:
Warning: Illegal string offset 'pro_widgets' in /home/customer/www/gedysa.com/public_html/wp-content/plugins/elementor/includes/api.php on line 164
Warning: Illegal string offset 'pro_widgets' in /home/customer/www/gedysa.com/public_html/wp-content/plugins/elementor/includes/api.php on line 167
I have gone where apparently the problem is, in the php archive of jupiter plugin and it look like this:
164 $data['pro_widgets'] = [];
165 }
166
167 return $data['pro_widgets'];
but I dont know what to do.
Could somebody help me??

Woocommerce PHP Warning for class-wc-admin-dashboard.php

Suddenly, my php log is getting flooded with this php warning:
Got error 'PHP message: PHP Warning: Invalid argument supplied for foreach() in /public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-dashboard.php on line 543', referer:
The warning always keep the same but the referer could be literally any page of the site, including back and front end. I really don't have a clue whats going on.
Any ideas?
Using a solution found in Invalid argument supplied for foreach()
You can edit 'class-wc-admin-dashboard.php' and add this code in line 543 (just before the foreach):
if (is_array($data) || is_object($data))

Invalid argument supplied for foreach() in web service API

I'm using PHP code to call Json API, but I'm having Issues loading.
PHP code
$response[$i]['id']=$dataFriend[$i]['id'];
$response[$i]['name']=$dataFriend[$i]['name'];
$response[$i]['id']=$id;
$response[$i]['lastMSGFrom']=$msg_from;
$response[$i]['lastMSGType']=$type;
$response[$i]['lastMSG']=$msg;
$response[$i]['lastMSGTime']=$time;
$response[$i]['lastSeen']=$dataFriend[$i]['date'];
$response[$i]['status']=$dataFriend[$i]['status'];
}
}
foreach ($response as $key => $row) {
$volume[$key] = $row['lastMSGTime'];
}
array_multisort($volume, SORT_DESC, $response);
array_unshift($response, $userData);
Error log
PHP Warning: Invalid argument supplied for foreach()
PHP Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag
PHP Warning: array_unshift() expects parameter 1 to be array, null given
PHP Warning: Invalid argument supplied for foreach()
PHP Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag
PHP Warning: array_unshift() expects parameter 1 to be array, null given
I would appreciate any ideas?

Warning: Invalid argument supplied for foreach() in classipress

I got an Error While i submit the Ad if i can not check the mandatory field in form,
The Error Is
Warning: Invalid argument supplied for foreach() in
/home/*******/public_html/wp-content/themes/classipress/includes/views-checkout.php
on line 1358
-
Warning: Invalid argument supplied for foreach() in
/home/*******/public_html/wp-content/themes/classipress/includes/views-checkout.php
on line 954
Check the code once foreach() can only accept array or object.
Note that
Provide code where you have this problem so I can help you better
foreach() can only accept the array or object

uploading large GIFS with Kusaba

This doesn't always happen. I could upload the same GIF sometimes and sometimes receive back this error, it seems almost random.
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*001/*.org/www/inc/classes/board-post.class.php on line 81
Warning: Cannot modify header information - headers already sent by (output started at /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php:81) in /webroot/i/n/*/*.org/www/board.php on line 343
Warning: Cannot modify header information - headers already sent by (output started at /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php:81) in /webroot/i/n/*/*.org/www/board.php on line 347
Warning: Cannot modify header information - headers already sent by (output started at /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php:81) in /webroot/i/n/*/*.org/www/board.php on line 350
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/func/posts.php on line 249
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php on line 136
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php on line 163
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/func/fetching.php on line 27
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php on line 343
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php on line 443
Warning: Invalid argument supplied for foreach() in /webroot/i/n/*/*.org/www/inc/func/fetching.php on line 27
Warning: Cannot modify header information - headers already sent by (output started at /webroot/i/n/*/*.org/www/inc/classes/board-post.class.php:81) in /webroot/i/n/*/*.org/www/inc/func/misc.php on line 76
Somewhere you're using a variable that's not an array in a foreach statement, like:
$foo = 123;
foreach ($foo as $bar)
This throws the Invalid argument supplied for foreach() warning. Check your variables better to make sure they're arrays when they're expected to be.
The fact that this warning was thrown and output blocks headers from being sent, which causes the other Cannot modify header information warning.
If you want to cycle through the $results array, you should write
foreach ($results as $key=>$value)
rather than
foreach ($results[0] as $key=>$value)
unless $results[0] itself is an array, in which case $results would be a matrix (array of arrays).

Categories