-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Describe the bug
hey there 👋
I'm from WP Rocket support team, we are getting reports from our users that they are getting fatal errors when using Ajax Search Pro and WP Rocket.
In this recent update:
https://changelog.ajaxsearchpro.com/#id-4.26.14-2024-08-05
Includes a related change to apply compatibility with caching plugins like WP Rocket to stop them from combining their JS files:
#143
Based on the error logs, you are trying to pass a value asp-(.*).js to our filter to exclude scripts from being combined. But it seems you are using the wrong filter in /ajax-search-pro/includes/classes/Hooks/FiltersManager.php:238 :
pre_get_rocket_option_exclude_js is not correct to disable/enable the feature. and it expects a true/false
it would be best if you used rocket_exclude_defer_js instead
https://github.com/wp-media/wp-rocket/blob/961f78501527775c9cc22b6f284cdcf31f9048f6/inc/Engine/Optimization/DeferJS/DeferJS.php#L206
This is the error:
[2024-08-07T15:25:55.660315+00:00] PHP Fatal error: Uncaught TypeError: WP_Rocket\Engine\Optimization\DeferJS\Subscriber::exclude_jquery_combine(): Argument #1 ($excluded_files) must be of type array, string given, called in /wp-includes/class-wp-hook.php on line 324 and defined in /wp-content/plugins/wp-rocket/inc/Engine/Optimization/DeferJS/Subscriber.php:73#012Stack trace:#012#0 /wp-includes/class-wp-hook.php(324): WP_Rocket\Engine\Optimization\DeferJS\Subscriber->exclude_jquery_combine('asp-(.*).js')#012#1 /wp-includes/plugin.php(205): WP_Hook->apply_filters('asp-(.*).js', Array[...]
To Reproduce
Steps to reproduce the behavior:
- Enable the last version of Aax Search Pro, and the WP Rocket.
- See the fatal error
Expected behavior
To exclude a set of files from the value should be filtered at rocket_exclude_defer_js. Here is an example:
https://github.com/wp-media/wp-rocket-helpers/blob/e90b1ed20517ca679e122bca78686346ad6c124e/static-files/wp-rocket-static-exclude-defer-js/wp-rocket-static-exclude-defer-js.php#L35
Environment checklist
- This bug happens with only Ajax Search Pro plugin active
- This bug happens with a default WordPress theme active
- I can reproduce this bug consistently
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status