Forum Replies Created

Viewing 15 replies - 1 through 15 (of 98 total)
  • Thread Starter Austin Ginder

    (@austinginder)

    Great, thank you!

    Thread Starter Austin Ginder

    (@austinginder)

    Sure thing! I have confirmed that upgrading to v1.2.6 is stable. Thanks for the quick release.

    Austin Ginder

    (@austinginder)

    It’s not a separate issue. I have the same PHP fatal in my error logs and we’re using the same web host, Kinsta.

    Austin Ginder

    (@austinginder)

    If your still having issues, I posted solution here: https://ww.wp.xz.cn/support/topic/fatal-error-on-activation-236/.

    Austin Ginder

    (@austinginder)

    I had the same issue for one of my customer websites. This is both a bug with WooCommerce Square and also requires a configuration change to PHP in order to resolve. In regards to the plugin bug, WooCommerce Square is not properly detecting PHP’s opcache.save_comments configuration which is required by the plugin: https://woocommerce.com/document/woocommerce-square/setup-and-configuration-of-the-woocommerce-square/. With Kinsta, simply reach out to their live chat support and request that they enable it per each site you plan to use WooCommerce Square. By default Kinsta doesn’t have PHP’s opcache.save_comments enabled. Once that’s been addressed, you should be safe to activate WooCommerce Square.

    WooCommerce Square Support, can you fix this bug? You should be able to reproduce the PHP fatal by turning off PHP’s opcache.save_comments and then try activating WooCommerce Square.

    Thread Starter Austin Ginder

    (@austinginder)

    Ah that might be it. I just cleared the CDN cache. Will keep an eye on it. Thanks for the followup!

    If you have SSH, here is a handy bash script to rollback.

    version=$(wp plugin get woocommerce-services --field=version --skip-themes --skip-plugins)
    if [[ "$version" == "3.0.6" ]]; then
    wp plugin install woocommerce-services --version=3.0.5 --force --skip-themes --skip-plugins
    fi

    I’m seeing similar PHP fatals on my customer websites.

    PHP Warning:  require(/www/public/wp-content/plugins/woocommerce-services/src/StoreNotices/StoreNoticesNotifier.php): Failed to open stream: No such file or directory in /www/public/wp-content/plugins/jetpack/vendor/jetpack-autoloader/class-php-autoloader.php on line 102
    Warning: require(/www/public/wp-content/plugins/woocommerce-services/src/StoreNotices/StoreNoticesNotifier.php): Failed to open stream: No such file or directory in /www/public/wp-content/plugins/jetpack/vendor/jetpack-autoloader/class-php-autoloader.php on line 102
    PHP Fatal error: Uncaught Error: Failed opening required '/www/public/wp-content/plugins/woocommerce-services/src/StoreNotices/StoreNoticesNotifier.php' (include_path='.:/usr/share/php') in /www/public/wp-content/plugins/jetpack/vendor/jetpack-autoloader/class-php-autoloader.php:102
    Stack trace:
    #0 /www/public/wp-content/plugins/woocommerce-services/woocommerce-services.php(876): Automattic\Jetpack\Autoloader\jpf11009ded9fc4592b6a05b61ce272b3c_jetpackⓥ14_8\al5_0_8\PHP_Autoloader::load_class()
    #1 /www/public/wp-content/plugins/woocommerce-services/woocommerce-services.php(734): WC_Connect_Loader->load_dependencies()
    #2 /www/public/wp-includes/class-wp-hook.php(324): WC_Connect_Loader->pre_wc_init()
    #3 /www/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #4 /www/public/wp-includes/plugin.php(517): WP_Hook->do_action()
    #5 /www/public/wp-content/plugins/woocommerce/includes/class-woocommerce.php(851): do_action()
    #6 /www/public/wp-includes/class-wp-hook.php(324): WooCommerce->init()
    #7 /www/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #8 /www/public/wp-includes/plugin.php(517): WP_Hook->do_action()
    #9 /www/public/wp-settings.php(727): do_action()
    #10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1374): require('...')
    #11 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1293): WP_CLI\Runner->load_wordpress()
    #12 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
    #13 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(84): WP_CLI\Bootstrap\LaunchRunner->process()
    #14 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(35): WP_CLI\bootstrap()
    #15 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('...')
    #16 /usr/local/bin/wp(4): include('...')
    #17 {main}
    thrown in /www/public/wp-content/plugins/jetpack/vendor/jetpack-autoloader/class-php-autoloader.php on line 102
    Fatal error: Uncaught Error: Failed opening required '/www/public/wp-content/plugins/woocommerce-services/src/StoreNotices/StoreNoticesNotifier.php' (include_path='.:/usr/share/php') in /www/public/wp-content/plugins/jetpack/vendor/jetpack-autoloader/class-php-autoloader.php:102

    The problem is that lc_twicedaily_refresh_req was repeatably added to WordPress cron. On one of my customer websites, the database row for cron in the options table was over 20MBs large. Even with SSH and WP-CLI, removing all cron events lc_twicedaily_refresh_req would take all day to purge. Cleaning up these types of issues are messy, especially when WordPress is overloaded. Here is how I restored a few of my customer websites with Kinsta over SSH.

    Enable maintenance mode manually

    cd ~/public
    echo '<?php $upgrading = time(); ?>' > .maintenance

    Restart Kinsta PHP workers then export current cron events to JSON file.

    wp option get cron --format=json --skip-themes --skip-plugins > cron.json

    Create the following cron-purge.php

    <?php
    /**
    * This script cleans the 'cron' option in the WordPress database by removing
    * events related to 'lc_twicedaily_refresh_req'.
    *
    * Usage: wp eval-file cron-purge.php
    */

    // Path to the cron.json file. Make sure this is correct!
    $cron_file = 'cron.json';

    if ( ! file_exists( $cron_file ) ) {
    WP_CLI::error( "Cron file not found: $cron_file" );
    return;
    }

    $cron_data_json = file_get_contents( $cron_file );

    if ( false === $cron_data_json ) {
    WP_CLI::error( 'Failed to read cron data from file.' );
    return;
    }

    $cron_data = json_decode( $cron_data_json, true );

    if ( null === $cron_data && json_last_error() !== JSON_ERROR_NONE ) {
    WP_CLI::error( 'Failed to decode cron data: ' . json_last_error_msg() );
    return;
    }

    if ( ! is_array( $cron_data ) ) {
    WP_CLI::error( 'Cron data is not an array.' );
    return;
    }

    $removed_count = 0;

    foreach ( $cron_data as $timestamp => $events ) {
    if ( is_array( $events ) ) {
    foreach ( $events as $hook => $details ) {
    if ( strpos( $hook, 'lc_twicedaily_refresh_req' ) !== false ) {
    unset( $cron_data[ $timestamp ][ $hook ] );
    $removed_count++;
    }
    }
    // Clean up empty timestamp entries
    if ( empty( $cron_data[ $timestamp ] ) ) {
    unset( $cron_data[ $timestamp ] );
    }
    }
    }

    // Update the option in the database.
    $result = update_option( 'cron', $cron_data, false );

    if ( $result ) {
    WP_CLI::success(
    sprintf(
    'Successfully cleaned cron data. Removed %d events. Option updated.',
    $removed_count
    )
    );
    } else {
    WP_CLI::error( 'Failed to update the cron option.' );
    }

    Run wp eval-file cron-purge.php --skip-themes --skip-plugins. One my site the response looked like this:

    Success: Successfully cleaned cron data. Removed 130982 events. Option updated.

    Lastly remove the maintenance file to restore the website.

    rm .maintenance

    Since the WordPress cron might not have been running properly for the last few days, I recommend running all outstanding items.

    wp cron event run --due-now
    Thread Starter Austin Ginder

    (@austinginder)

    Awesome, thank you 👏

    Thread Starter Austin Ginder

    (@austinginder)

    Thanks!

    Thread Starter Austin Ginder

    (@austinginder)

    I believe I have found a fix. It would appear that the websites affected where never properly configured to work with WooCommerce Square. Here are the steps I took.

    wp plugin install woocommerce-square --version=4.7.3 --force
    wp plugin toggle woocommerce-square
    wp plugin toggle woocommerce-square
    wp cache flush

    This seems to restore WordPress with a new message to ensure PHP’s opcache.save_comments is enabled. Next reach out to your web host to have them enable that as described here. Last you should be safe to update WooCommerce Square to the latest version.

    I’ve now encountered this bug on 4 different website. The root issue appears to be that PHP’s opcache.save_comments was never enabled and the plugin isn’t properly detecting that.

    Same. After updating to v1.1.5 I’ve been seeing the following PHP fatals in my error log. It may just be background errors. I’m not sure as my host provider emails recurring PHP fatals no matter how they are triggered. I’m on PHP 8.0.

    2024/03/21 13:01:14 [error] 61371#61371: *566487 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in /www/public/wp-content/plugins/smart-app-banner/wsl-smart-app-banner.php:49
    Thread Starter Austin Ginder

    (@austinginder)

    That would be great! I’d be happy to test it out and report back.

    Thread Starter Austin Ginder

    (@austinginder)

    It’s happening for a few different WordPress sites. So far it looks like those sites are on PHP 8.1.18. I tried upgrade one of the affected sites to PHP 8.2.15, same error. I have a Lifetime Full Bundle license however this bug seems to be happening only on website using the free Kadence Blocks plugin. The paid customer websites seem fine.

Viewing 15 replies - 1 through 15 (of 98 total)