Page 1 of 1

foreach errors

Posted: Sat Jun 17, 2006 5:21 am
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

Re: foreach errors

Posted: Sat Jun 17, 2006 5:06 pm
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

Posted: Sat Jun 17, 2006 6:27 pm
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

Posted: Sun Jun 18, 2006 11:41 am
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. ;)

Posted: Sun Jun 18, 2006 11:43 am
by garvinhicking
Hi!

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

Best regards,
Garvin