Skip Navigation

[Resolved] in “class-wp-installer.php” creates “Invalid argument supplied for foreach()”

This thread is resolved. Here is a description of the problem and solution.

Problem: I'm seeing several PHP warnings on my site and in my error logs, saying "Invalid argument supplied for foreach()", and pointing to the file "class-wp-installer.php"

Solution: The minimum PHP version Toolset officially supports is 5.3. This site is running 5.2.17, which falls into a gray area that should work but may not. The best suggestion is to upgrade to a more modern version of PHP.

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 7 replies, has 3 voices.

Last updated by Schmid 6 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#559267
Bildschirmfoto 2017-08-13 um 11.00.43.png
Bildschirmfoto 2017-08-13 um 11.00.35.png

Hi there,

I just updated the Toolset-PlugIns. The site (hidden link) is still running and everything but with having Types (Version 2.2.15.1) activated, the Plugins-Page output´s tons of error messages saying that the file "class-wp-installer.php" (within the Types plugin folder) is giving an "invalid argument" – you can see this on the screenshots. In addition al the special characters on this page are broken ( like ö,ä etc.) Any idea what is creating this?

Note: I´m aware that I´m not running the latest WP-Version. I´m a bit afraid to update this now because of this Types-error.

THANKS!

Cheers,
Manuel

#559271

I just checked the lines in the "class-wp-installer.php" file.

(lines 308, 1568, 2255)

It´s always:
foreach ( $product['plugins'] as $plugin_slug ) {

#559364

Note: I´m aware that I´m not running the latest WP-Version. I´m a bit afraid to update this now because of this Types-error.
What you're seeing is PHP warnings, not errors. They shouldn't have any effect on the functionality of your site. If you want to suppress warning display on-screen, you can modify your settings in wp-config.php as described here:
https://codex.wordpress.org/Editing_wp-config.php
https://codex.wordpress.org/Debugging_in_WordPress
https://codex.wordpress.org/WP_DEBUG

However, the best advice is to update to the latest version of WordPress. Always make a backup of your site before you attempt an update, so you can revert quickly if necessary. If the warnings are not resolved, try the following troubleshooting steps:
1. Temporarily activate a default theme like Twenty Seventeen, and temporarily deactivate all plugins except Types and Views. Then reload the plugins page.
2. If the warnings are resolved, reactivate your theme and plugins one-by-one until the conflict is revealed. If the warnings are not resolved, I can take a closer look. Please let me know once you have updated WordPress.

#559460
Bildschirmfoto 2017-08-14 um 10.31.16.png
Bildschirmfoto 2017-08-14 um 10.30.29.png

Hi Christian,

thanks for your fast reply!

True, it does not have any effect on the functionality of the site.

Actually I do have exactly the same behaviour on another site: fabricemillischer.com
For this site I already have a local backup so I started troubleshooting on this page first ...

I updated WP to the latest version –> Types php warnings still still there
I switched to Twenty Seventeen –> Types php warnings still there
I deactivated all Plugins except Types/Views –> Types php warnings still there
(see screenshots)

Any ideas?

Thanks again!
Manuel

#559557

It appears that you're using a version of PHP that isn't officially supported. Your server is running PHP 5.2.17, and Toolset's minimum requirements state that you should use at least PHP 5.3:
https://toolset.com/toolset-requirements/

5.2.17 is in a gray area (5.2.4 - 5.3), which should work, but may throw warnings like this. Our developers probably won't address warnings in a version of PHP lower than 5.3, since it's not officially supported. Can you ask your host to upgrade you to a newer PHP version that meets our minimum criteria?

#560065

Hi Christian,

thanks again!

Oh yes, you are probably right that the php-version is causing this.
I don´t have direct access to the hosting-provider but once the php-version is updated it will be solved I think. So I mark this thread as solved.

Have a great evening!
Manuel

#560224

Hi again,

for whatever reason the php-warnings disappeared on both pages today ... without doing anyting. 🙂
Anyway I updated the PHP-versions now and everything is fine.

Cheers,
Manuel

#589805

Hello,
I have exactly the same issue. Updating to PHP 7.1.6 didn't help.

Please fix this error. It is literally as simple as putting

if (!empty($product['plugins'])) {

around the offending blocks.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.