• Resolved mdbstc

    (@mdbstc)


    Hello,
    first of all, thank you for this great plugin. However, I believe I found a bug in APCu Manager 4.2.0.

    The method WP_Object_Cache->set_non_persistent() in
    ../apcu-manager/includes/api/object-class.php at line 1176 is supposed to return a boolean value, but it currently returns the variable instead.

    This leads to PHP errors when combined with WooCommerce (from version 9.9), because the value is passed down to the wp_cache_set() function in /wp-content/object-cache.php:

    Uncaught TypeError: Automattic\WooCommerce\Internal\Admin\Logging\FileV2\FileController::invalidate_cache(): Return value must be of type bool, string returned in /html/wordpress/wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php:678    

    Uncaught TypeError: Automattic\WooCommerce\Caches\OrderCountCache::set(): Return value must be of type bool, int returned in /html/wordpress/wp-content/plugins/woocommerce/src/Caches/OrderCountCache.php:89

    As a test, I modified line 1180 in
    …/apcu-manager/includes/api/object-class.php as follows:

    $this->non_persistent_cache[ $key ] = $var;
    return true;

    This change removes the PHP errors.

    It would be great if you could take a look at this issue and maybe include a fix in the next update.

    Many thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘set_non_persistent() returns variable instead of boolean’ is closed to new replies.