Fatal error in ACF integration when saving non-cacheable post types
-
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 28Error:
Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool givenRoot 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()returnsfalse. Line 26 correctly detects this and callsupdate_option()to set the default, but doesn’t reassign$allowed_cpts— so it’s stillfalsewhen passed toin_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
You must be logged in to reply to this topic.