1 (edited by 2012-06-12 15:19:03)

Topic: Error: Invalid argument supplied for foreach()

I've just started getting this error come up now (sorry for posting another topic so soon!)

PHP Warning:  Invalid argument supplied for foreach() in /home/starsfan/public_html/cutenews/inc/shows.inc.php on line 754


I've had these errors turn up before (after PHP has been updated on my site's server - I think?). In the past I've had to edit certain lines on certain pages and the errors stop.

This is what's on line 754

foreach($all_news as $news_line){


Anyone know how I need to edit it to make this error go away?

I'm using v8 (lKj's version) of Cutenews.

Re: Error: Invalid argument supplied for foreach()

I don't use utf8-cutenews so I cannot give a precise answer but:

This error can occur when the argument received by 'foreach' is not an array or the array has not been set.
$all_news may have a null value instead of being empty.
You willl need to trace back and find where $all_news is being set (or why it isn't).

Re: Error: Invalid argument supplied for foreach()

So you're saying I need to look for "$all_news" in the code on the shows.inc.php page? I don't understand PHP coding personally, so I do rely heavily on getting help from experts on here from time to time, like now.

Re: Error: Invalid argument supplied for foreach()

So you're saying I need to look for "$all_news" in the code on the shows.inc.php page? I don't understand PHP coding personally, so I do rely heavily on getting help from experts on here from time to time, like now.

Yes. Find where it is being set. Which file is it looking at.

Re: Error: Invalid argument supplied for foreach()

This is where $all_news is shown in the shows.inc.php page...

Line 720:

$all_news = file($news_file);

Line 721:

if($reverse == TRUE){ $all_news = array_reverse($all_news); }

Line 725:

foreach($all_news as $news_line){

Line 745:

$count_all = count($all_news);

Line 883:

$all_news = file("$cutepath/data/archives/$in_use.news.arch");

That was all I could find.

6 (edited by 2012-06-16 22:07:44)

Re: Error: Invalid argument supplied for foreach()

Just found that this is also coming up as an error too:

PHP Warning: Invalid argument supplied for foreach() in /home/starsfan/public_html/cutenews/inc/shows.inc.php on line 725


The content of line 725 was mentioned in my previous post above.

Re: Error: Invalid argument supplied for foreach()

Just found that this is also coming up as an error too:

The content of line 725 was mentioned in my previous post above.

Thanks. I was having a similar issue

Posts: 7

Pages 1

You must login or register to post a reply

CutePHP Forums → Problem Solving / Help & Support → Error: Invalid argument supplied for foreach()



The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.