Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Invalid argument after upgrading
Avatar
Fabien
Rookie
Free Members
sp_UserOfflineSmall Offline
Apr 28, 2014 - 6:48 pm

Hi,

After upgrading to Wordpress 3.9 and Simple:Press 5.4.2 the following message is displayed at the top of the forum :

Warning: Invalid argument supplied for foreach() in /wp-content/plugins/simple-press/forum/content/classes/sp-list-topic-class.php on line 416

Can you please tell me how to remove it ?

Best Regards,

Fabien

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 28, 2014 - 11:08 pm

have you had any new posts since the upgrade?  I suspect one new post will make it disappear but may need Andy to confirm...  this a new cache put in place and yours seems to not be primed...  obviously if thats the case we need to handle that situation but need some confirmation first...

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 29, 2014 - 4:28 am

Actually this should not be an issue unless you have absolutely no posts in the forum at all. I have reworked the code so that it will no longer show up as a warning but the fact that you are seeing this is puzzling as if empty it should have been rebuilt.

I would be interested to know if this is seen on every page load and - if it does, indeed, go away when a new post is made.

Meanwhile I would really advise you against showing ANY errors like this. It discloses the path of the site to the casual observer and the recommended procedure is always to log these and not display them. I would personally be having very strong words with my host if this were my site!

andy-signature.png
YELLOW
SWORDFISH
Avatar
Fabien
Rookie
Free Members
sp_UserOfflineSmall Offline
Apr 29, 2014 - 4:34 am

My forum is new and there was no post at all. After posting a new post, the error message disappeared. Thank you !

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 29, 2014 - 4:35 am

That explains it. Thanks for the update. That code has been cleaned up so as not to necessarily expect posts! Appreciate the info.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Fabien
Rookie
Free Members
sp_UserOfflineSmall Offline
Apr 29, 2014 - 4:41 am

You're right, I would not have had to write the entire path. Rookie mistake !

Can you please delete the path in my first message. ? I am not able to edit the message.

Thanks

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 29, 2014 - 5:26 am

Done. But I was really meaning on your own site. Really bad form to show any errors on the public side... That includes notices and warnings.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Biz Buzz
Rookie
Free Members
sp_UserOfflineSmall Offline
May 1, 2014 - 9:13 am

Hello, I hope I am not overstepping my bounds, but I got the very same error on my site, so I just chose to piggy back this post.

And yes, it is showing up so will have to discuss that with the host, however, let me tell you this.

I only installed 5.4.2 yesterday, and when I went in to start creating forums, this is the error that came up, exactly like posted above.

Thinking I would just have to submit a post and it would clear up, I came up with these errors:

Warning: array_unshift() expects parameter 1 to be array, string given in /wp-content/plugins/simple-press/sp-api/sp-api-class-post.php on line 457

Warning: Cannot modify header information - headers already sent by (output started at wp-content/plugins/simple-press/sp-api/sp-api-class-post.php:457) in /wp-includes/pluggable.php on line 1121

I had to back up, and refresh the page, and now it's showing my topic and the error message is gone.

Any thoughts?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
May 1, 2014 - 11:17 am

Afraid it was caused by the same condition - no posts. At the time of writing the post there were still none in the database so it came up with the same warning. The headers already sent error was caused by the fact that the first real error (Warning) was printed to the display.

Apologies for it happening but once there is at least one post in the database all should then be well and these are fixed up in the next update...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Biz Buzz
Rookie
Free Members
sp_UserOfflineSmall Offline
May 1, 2014 - 12:52 pm

Since there is no "like" or "thanks" button, I am replying with a hearty THANKS!

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626