PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

PHP 8.1+ fatal on manufacturer filter (HUSKY v1.3.7.1) — worked on 7.4

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi,

Keep in mind it is on php 7.4 now again and works perfectly. It is only when going to php 8.1 plus that the issue happens...which this issue is preventing us from upgrading to php 8.1 plus at the moment so if you could send a patched plugin or code snippet or solution to until a final fix is rolled out in the official plugin that would be wonderful.

After upgrading from PHP 7.4 → 8.1, selecting a manufacturer filter triggers a fatal error inside HUSKY’s woocommerce_shortcode_products_query callback. It only happens on manufacturer filtering; other categories work. Reverting to PHP 7.4 makes the issue disappear.

Public URL (live repro) as Repro URL example but any manufacturer dropdown:

Manufacturer example (click loads with HUSKY filter applied):
https://wingdom.store/shop/?swoof=1&pa_manufacturer=ae-cage-co

(Other manufacturers show the same behavior.)

Expected vs actual

Expected: Manufacturer filter narrows products without errors.

Actual (PHP 8.1+): Critical error page; PHP fatal TypeError from array_merge() receiving null as one operand.

Error details (from error log / on-screen)

Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, null given
in /wp-content/plugins/woocommerce-products-filter/index.php:1838

Stack trace (abridged):
#0 .../woocommerce-products-filter/index.php(1838): array_merge(Array, NULL)
#1 .../wp-includes/class-wp-hook.php(324): WOOF->woocommerce_shortcode_products_query(Array, Array, 'products')
#2 .../wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#3 .../woocommerce/includes/shortcodes/class-wc-shortcode-products.php(237): apply_filters('woocommerce_sho...', Array, Array, 'products')
#4 .../themes/Divi/includes/builder/module/woocommerce/Shop.php(897): do_shortcode('[products ...]')
...

On PHP 7.4 this didn’t fatal; on PHP 8.x array_merge() with null throws.

Environment

WordPress: 6.7.x (notices reference 6.7)

WooCommerce: 10.1.2

Theme/Builder: Divi (Shop module uses [products] shortcode)

HUSKY – Products Filter Professional for WooCommerce: v1.3.7.1

Multisite: Yes (subsites)

PHP: 8.1.x (issue); 7.4 (no issue)

Caching: WP Rocket (search paths excluded)

Server: Apache/LiteSpeed on cPanel host

Steps to reproduce (reliable)

1. PHP set to 8.1.x.

2. Visit shop page built with Divi Shop (which renders [products]).

3. Use HUSKY to filter by Manufacturer (taxonomy: pa_manufacturer).

4. Page crashes with the fatal above.

5. Switching PHP back to 7.4 makes the same action succeed.

 

Things we already tried (still reproduces)

Updated WooCommerce & theme; cleared all caches.

WooCommerce → Status → Tools → Regenerate product lookup tables (completed).

Settings → Permalinks → Save (flush).

Verified Attributes → pa_manufacturer → Enable archives = ON.

HUSKY options toggled:

OFF “Ajaxify the shop” → still crashes.

OFF “Integrate with [products] / Divi/shortcode compatibility” → reduces frequency, but manufacturer archive paths via shortcode still hit the same merge.

Multisite rewrites and domain mapping confirmed OK (not related).

Temporary workarounds (confirm root cause)

One-line code hot-patch at the crash site prevents the fatal on PHP 8.x by casting to arrays (restores 7.4 behavior):

In wp-content/plugins/woocommerce-products-filter/index.php near the failing merge:

// Before (crashes when second arg is null on PHP 8.x):
$args = array_merge( $args, $woof_additional_args );

// After (works on PHP 8.x too):
$args = array_merge( (array) $args, (array) $woof_additional_args );

(In some builds the second variable is named $woof_tax_query; same fix.)

Non-intrusive guard via MU/Code Snippets (to avoid editing plugin files):
Remove HUSKY’s shortcode filter only on manufacturer archives:

add_action('init', function () {
if (isset($GLOBALS['WOOF']) && is_object($GLOBALS['WOOF'])) {
$woof = $GLOBALS['WOOF'];
add_action('wp', function () use ($woof) {
if (is_tax('pa_manufacturer')) {
remove_filter('woocommerce_shortcode_products_query', [$woof, 'woocommerce_shortcode_products_query'], 10);
}
}, 1);
}
});

This unhooks the crashing path and lets WooCommerce’s native query render the manufacturer page. It’s a stopgap.

Both workarounds confirm the issue is an unprotected array_merge() with a possible null operand in the shortcode query filter.

Request

Please ship a fix that safely handles null in all array_merge() calls within the woocommerce_shortcode_products_query handler. A simple (array) cast (or checking with is_array() / defaulting to []) is sufficient and backwards-compatible.

Example pattern:

$args = array_merge( (array) $args, (array) $extra_args );

If there’s a newer build where this is already addressed for PHP 8.1/8.2/8.3+, please point us to it and we’ll test immediately.

Optional diagnostic notes

This only manifests when the page goes through the [products] shortcode (e.g., Divi’s Shop module); native taxonomy archives are fine.

Other filters (categories, tags) generally work; manufacturer reliably triggers the null merge path.

We can provide a staging admin account if needed.

Thanks for looking—happy to test a patched build or beta and report back quickly.


Greg Baugh

Repro URL example but any manufacturer dropdown:

https://wingdom.store/shop/?swoof=1&pa_manufacturer=ae-cage-co

Hello

Thank you for your cooperation

I would be glad if you could share wp-admin+ftp access - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134615.png  - I would like to find the reason deeper

Hi there.

On this,"I would be glad if you could share wp-admin+ftp access - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134615.png  - I would like to find the reason deeper" I have added all the info in the private area.

OK...thanks...let me know?

:)

Greg

Hey there..

Also, the dropdown for Manufacturer is here under Shop FYI https://app.screencast.com/cdTfQZvNmWCv8 (do not click it but copy and paste it and put in your browser so it will work...otherwise it will go to techsmith login FYI). You do not really need this screenshot...all it is showing is that the Manufacturer dropdown is on the left sidebard on the Shop menu page...

On this,"I would be glad if you could share wp-admin+ftp access - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134615.png  - I would like to find the reason deeper" I have added all the info in the private area.

OK...thanks...let me know?

:)

Greg

Hello Greg

Unfortunately I didn't find the real reason. Perhaps you use this hook 'woof_get_meta_query' in custom code?

In any case, the solution to the error:  in file  - \wp-content\plugins\woocommerce-products-filter\index.php  - I changed code - https://share.pluginus.net/image/i20250829123435.png

return apply_filters('woof_get_meta_query', $meta_query) ?? array();