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).
Related
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))
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?
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
I have 266 filters in 1 group in opencart. Then I am trying to add the 267th and I get this error:
Notice: Undefined index: filter_description in /home/eshop/public_html/admin/controller/catalog/filter.php on
line 386
Warning: Invalid argument supplied for foreach() in
/home/eshop/public_html/admin/controller/catalog/filter.php on
line 386
Notice: Undefined index: sort_order in
/home/eshop/public_html/vqmod/vqcache/vq2-admin_model_catalog_filter.php
on line 48
Notice: Undefined index: filter_description in
/home/eshop/public_html/vqmod/vqcache/vq2-admin_model_catalog_filter.php
on line 53
Warning: Invalid argument supplied for foreach() in
/home/eshop/public_html/vqmod/vqcache/vq2-admin_model_catalog_filter.php
on line 53
Warning: Cannot modify header information - headers already
sent by (output started at
/home/eshop/public_html/admin/index.php:85) in
/home/eshop/public_html/vqmod/vqcache/vq2-system_engine_controller.php
on line 28
Warning: Cannot modify header information - headers already
sent by (output started at
/home/eshop/public_html/admin/index.php:85) in
/home/eshop/public_html/vqmod/vqcache/vq2-system_engine_controller.php
on line 29
Is there a limit in the number of filters in a group?
My Oc version is 1.5.6.4
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)