• Resolved Roland

    (@rolandfarkas)


    Bug: Fatal error in ACF integration when saving non-cacheable post types

    Plugin version: Latest PHP version: 8.3

    File: classes/Integration/Plugin/ACF.php, line 28

    Error:

    Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given
    

    Root cause:

    In invalidate_post_due_to_acf_change(), line 23 reads:

    $allowed_cpts = get_option('nitropack-cacheableObjectTypes');
    

    When this option doesn’t exist yet (e.g., fresh install or after a reset), get_option() returns false. Line 26 correctly detects this and calls update_option() to set the default, but doesn’t reassign $allowed_cpts — so it’s still false when passed to in_array() on line 28.

    Fix: Reassign the variable after computing the default:

    if (!is_array($allowed_cpts)) {
        $allowed_cpts = CPTOptimization::getInstance()->nitropack_get_default_cacheable_object_types();
        update_option("nitropack-cacheableObjectTypes", $allowed_cpts);
    }
    

    This happens when saving any post type via ACF (in our case, WooCommerce coupons — shop_coupon).

    Can you please update this?

    Cheers,
    Roland

Viewing 1 replies (of 1 total)
  • Hey Roland,

    Thanks for reporting this.

    We will add a fix in the next plugin release.

    Best,
    Plamen, Head of Support

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.