Skip Navigation

[Resolved] PHP fatal error with AJAX filtering

This thread is resolved. Here is a description of the problem and solution.

Problem: AJAX pagination and filtering in archives is causing PHP fatal errors.

Solution: Update to the latest versions of Toolset plugins to get the fix for this issue.

This support ticket is created 2 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#2115081

We have a View with AJAX filtering of WooCommerce products - see here

hidden link

AJAX filtering times out and the following errors appear in the server logs:

[Thu Jul 15 09:43:05.594991 2021] [proxy_fcgi:error] [pid 14536:tid 140534265796352] [client 91.196.28.9:55762] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function filtering_via_lookup_table_is_active() on null in /home/536730.cloudwaysapps.com/uxgwfcjtmz/public_html/wp-content/plugins/woocommerce/includes/class-wc-query.php:769\nStack trace:\n#0 /home/536730.cloudwaysapps.com/uxgwfcjtmz/public_html/wp-content/plugins/toolset-blocks/application/models/WooCommerce/WcQuery.php(287): WC_Query->get_tax_query()\n#1 /home/536730.cloudwaysapps.com/uxgwfcjtmz/public_html/wp-content/plugins/toolset-blocks/application/models/WooCommerce/WcQuery.php(259): OTGS\\Toolset\\Views\\Model\\WooCommerce\\WcQuery->product_query()\n#2 /home/536730.cloudwaysapps.com/uxgwfcjtmz/public_html/wp-includes/class-wp-hook.php(292): OTGS\\Toolset\\Views\\Model\\WooCommerce\\WcQuery->pre_get_posts()\n#3 /home/536730.cloudwaysapps.com/uxgwfcjtmz/public_html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()\n#4 /home/536730.cloudwaysapps.com/uxgwfcjtmz/public_html/wp-includes/plugin.php(551): WP_Hook->do_action()\n#5 /home/53...', referer: hidden link

Everything is up to date. I am wondering if this is related to last night's emergency WooCommerce release that patched a security hole, as this function has been working fine since the site launched.

#2115093

I meant WooCommerce release, above, not WordPress release!

#2115155

Just to add, the bug is also preventing pagination from functioning - obviously also tied into AJAX

#2115605

Hi, I'm able to reproduce a similar error in my local test of a Product Category archive with AJAX filtering based on a custom taxonomy. The error message is identical:

PHP Fatal error:  Uncaught Error: Call to a member function filtering_via_lookup_table_is_active() on nul

Let me try some filter variations and escalate this to my 2nd tier support team for further investigation. I am up-to-date on the latest WooCommerce as well, so it could be related to the recent release. I'll let you know what I find out.

#2115645

Okay I was able to reproduce similar errors with pagination and with filters based on custom field values as well, so I've escalated this to my 2nd tier support team for further investigation. I'll let you know what they discover and keep you posted here.

#2118005

We've discovered the issue actually began in the WooCommerce 5.5.0 update, and rolling back to WC 5.4.2 will temporarily resolve the problem. Our developers are working on a fix and I'll let you know as soon as it's available.

#2118007

Thanks for the update. In light of the recent security issue on Woo - hidden link - we obviously won't be in a position to roll back WooCommerce, as every version from 3.3 contains the vulnerability. So we will stand by for a fix.

Thanks!

#2118845

Our developers have informed me that the permanent fix for this problem will be included in the upcoming Views and Blocks releases, which we tentatively plan to release later this week or early next week. In the meantime, considering this is a significant problem potentially impacting many clients, we have created a patch to solve the problem now, with the latest version of WooCommerce active. Please find the patch file available for download at the following link:
https://drive.google.com/file/d/1jmBXlElGhHoUhrd060WC7SK9XvC-3qvE/view?usp=sharing

To install the patch, download and unzip the package, then upload the WcQuery.php file it contains to replace the file with the same name in the following Toolset Blocks plugin path:

\wp-content\plugins\toolset-blocks\application\models\WooCommerce\WcQuery.php

For others who find this ticket:
If you are using the legacy Toolset Views plugin instead of the Toolset Blocks plugin, the patch file is identical for either plugin. You will upload the patch file to the corresponding Toolset Views plugin path:

\wp-content\plugins\wp-views\application\models\WooCommerce\WcQuery.php

AJAX filters and pagination should be working as expected now after applying the patch. Please let me know if the problem is not completely resolved.

#2118889

Great - I can confirm the patch worked on the afflicted site!

#2121487

Patch worked for me, too. Thank you!

#2125217

The permanent fix for this issue has been included in the latest round of plugin updates. After updating, the patch is no longer required.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.