Originally created by: unstatusthequo
I am seeing this error repeat over and over in the PHP Error Log snap-in in the dashboard. Any idea on what could be causing this? I literally just installed and haven't really done anything beyond that.
PHP Warning: Invalid argument supplied for foreach() in /var/www/html/wp-cron.php on line 117
Originally posted by: jessuppi
Thanks for sharing @unstatusthequo
I have seen this on some SlickStack sites and not others, immediately after setup is complete. I'm not sure but it's probably caused by one of our default MU plugins.
There are a few relevant threads on this issue:
https://wordpress.org/support/topic/wp-cron-php-problem/
Since I'm not sure what is causing it, I'm not sure what the fix would be yet, so we'll leave this Issue open for now and welcome new input on this. In any case, it is not a critical error.
Originally posted by: EdTrojas
About the error: ==
PHP Warning: Invalid argument supplied for foreach () in /var/www/html/wp-cron.php==I found a solution on a Wordpress forum. I´m not a developer, so I don't know if this solution has any harmful effect.
I am testing, monitoring, and waiting for some negative response when changing the WP-CRON.php code
-Is a wp bug, line 117 of wp-cron.php reads:
foreach ( $cronhooks as $hook => $keys ) {-this should read:
if ( $cronhooks ) foreach ( $cronhooks as $hook => $keys ) {or:
if ( is_array( $cronhooks ) ) foreach ( $cronhooks as $hook => $keys ) {-
this will prevent warning messages like: [Fri Aug 28 21:15:16.443167 2020] [fcgid:warn] [pid 62430] [client 77.68.64.25:32953] mod_fcgid: stderr: PHP Warning: Invalid argument supplied for foreach() in /home/domains/vol3/578/2510578/user/htdocs/wp-cron.php on line 117, referer: https://www.pakohl.com/wp-cron.php?doing_wp_cron=1598645713.5858569145202636718750-when
$cronhooksisfalseThe solution was obtained by Jacob N. Breetvelt (@opajaap) in the following topic of the Wordpress.org support:
https://wordpress.org/support/topic/cron-errors-3/
Hope it works for you too.