• Hello,

    We’ve recently installed ithemes and are now getting this error. It just continues and is the same error repealted per line.

    FastCGI sent in stderr: “PHP message: get_cart was called incorrectly. Get basket should not be called before the wp_loaded action. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘init’), WP_Hook->do_action, WP_Hook->apply_filters, ITSEC_Lockout->check_for_host_lockouts, ITSEC_Lockout->execute_lock, wp_logout, do_action(‘wp_logout’), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce_Groupons::wp_logout, WC_Cart->remove_coupons, WC_Cart_Session->set_session, WC_Cart_Session->get_cart_for_session, WC_Cart->get_cart, wc_doing_it_wrong. This message was added in version 2.3.PHP message: get_cart was called incorrectly. Get basket should not be called before the wp_loaded action. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘init’), WP_Hook->do_action, WP_Hook->apply_filters, ITSEC_Lockout->check_for_host_lockouts, ITSEC_Lockout->execute_lock, wp_logout, do_action(‘wp_logout’), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce_Groupons::wp_logout, WC_Cart->remove_coupons, WC_Cart_Session->set_session, WC_Cart_Session->get_cart_for_session, WC_Cart->get_cart, WC_Cart_Session->get_cart_from_session, do_action(‘woocommerce_cart_loaded_from_session’), WP_Hook->do_action, WP_Hook->apply_filters, WC_Cart_Session->set_session, WC_Cart_Session->get_cart_for_session, WC_Cart->get_cart, wc_doing_it_wrong. This message was added in version 2.3.PHP message: get_cart was called incorrectly. Get basket should not be called before the wp_loaded action. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘init’), WP_Hook->do_action, WP_Hook->apply_filters, ITSEC_Lockout->check_for_host_lockouts, ITSEC_Lockout->execute_lock, wp_logout, do_action(‘wp_logout’), WP_Hook->do_action, WP_Hook->a

    any ideas on how to resolve?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @dev,

    Not a full solution but if you change line #792 in the better-wp-security/core/lockout.php file:

    if ( is_object( $current_user ) && isset( $current_user->ID ) ) {

    to:

    if ( $current_user instanceof WP_User && $current_user->exists() ) {

    the error will only occur for logged in users.

    Currently the error occurs for both, logged in users as well as visitors (users not logged in). IMHO there is no point in calling wp_logout() for visitors ??

    Apart from the invalid condition (bug) this is definately a plugin conflict. The iTSec plugin lockout feature (aka Brute Force Protection) hooks into the init action which is executed (just) before the wp_loaded action.

    +++++ To prevent any confusion, I’m not iThemes +++++

    @timothyblynjacobs

    At least fix the invalid condition, another surviving dinosaur ??

    • This reply was modified 2 years, 9 months ago by nlpro.
    Thread Starter dev

    (@devksec)

    I’ve added that code in, thanks ??

    Will keep an eye out.

    Could it be wordfence, if so is there a guide on how now to conflict ?

    Got my hands on the Woocommerce Group Coupons plugin. Found an alternative method to prevent this error from happening.

    In WordPress Dashboard navigate to the Woocommerce->Group Coupons menu option. You should see a similar settings page like this.

    If currently enabled, disable the Remove coupons after logout. setting. Then click on the Save button.

    Contact ITTHINX if having doubts about disabling the setting ??

    Accoding to the 8.1.0 Changelog:

    Bug Fix: Compatibility with plugins that expected a logged-in user during lockouts.

    Checked the code and I can confirm the invalid condition bug has been fixed ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP message: get_cart was called incorrectly.’ is closed to new replies.