Coder Social home page Coder Social logo

Comments (3)

EdTrojas avatar EdTrojas commented on July 29, 2024 1

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 $cronhooks is false

The 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.

from slickstack.

jessuppi avatar jessuppi commented on July 29, 2024

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.

from slickstack.

jessuppi avatar jessuppi commented on July 29, 2024

Thanks very much for sharing that @EdTrojas and apologies for the long delay.

Here's a few other relevant threads now:

Ref: https://wordpress.org/support/topic/wp-cron-php-problem/
Ref: https://wordpress.org/support/topic/invalid-argument-supplied-for-foreach-157/
Ref: https://wordpress.org/support/topic/cron-errors-3/
Ref: https://wordpress.org/support/topic/warning-with-wp-cron/

Also this comment seems relevant, in regard to plugins causing this, although I'm not sure it's accurate for all cases:

@autotutorial
3 years, 1 month ago
Hello @lukeau, the problem is that $ crons is created with the first parameter as a boolean value. I’m sure the text won’t be investigative. This error, theme, plugin or core WordPress :/ obviously the cron is retrieved from the database, maybe that fake means not to run any cron? Currently I can’t answer. ...

TLDR I think this was probably caused by one of our MU plugins previously, some of which haven't been updated in a while and have some rather complex coding style that we will be abandoning in the future.

Since we have since removed several MU plugins from our default installation, and since this doesn't seem to be directly caused by SlickStack, I'm going to close this Issue for now.

If any further feedback on this feel free to comment here or on the repos of our various plugins --

from slickstack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.