foreach errors

Found a bug? Tell us!!
Post Reply
headzoo
Posts: 2
Joined: Sat Jun 17, 2006 5:17 am

foreach errors

Post by headzoo »

Hi,
First of all, sorry, I didn't actually take note of the file or line when the errors popped up. I had a good idea of what was causing the error, so I just fixed it.

Using a fresh install on WinXP, using PHP 5.1.1, there were more than a few foreach errors the first time I logged in. They seemed to revolve around the categories.

It appears the scripts are trying to foreach through an array of categories, but since it's a fresh install, there are no categories, and so, no array.

In the admin area, this happened on the edit entries page, and categories page.

- Sean
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: foreach errors

Post by garvinhicking »

Hi!

Could you tell exactly where those foreach errors are comming (with line number and file) and which Serendipity version you are using?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
headzoo
Posts: 2
Joined: Sat Jun 17, 2006 5:17 am

Post by headzoo »

Garvin,
Sorry, but like I said, I didn't take note of the error information when it happened. I downloaded Serendipity yesterday, so it was the most bleeding edge version.

As soon as I created a single category, the errors went away. So it seems to me that you're generating a menu by foreaching through an array of category data, but until the first category is created, there is no array, which causes the error.

- Sean
kodewulf
Regular
Posts: 14
Joined: Mon Jun 12, 2006 7:57 am
Location: Melbourne, Australia

Post by kodewulf »

I had this happen with the Karma plugin. Once the author had karma, the error disappeared. I suspect it might be that the array / table that is being iterated using the foreach loop is empty or null. ;)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, if someone can post me exact error messages, I'll have a look :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply