Open kswro opened 12 months ago
Hi,
Thank you for the detailed report. I see an issue right away, and it looks like it is unrelated to either of the plugins, and is very likely not a bug in either.
This line tells a lot to me:
apply_filters('wpml_permalink', Object(WP_Error), 'en')
This is how the permalink is requested from WPML via the wpml_permalink hook. However notice the first argument, it is WP_Error object, which should be the link to the taxonomy term. That means, the original link requested from WordPress returned an Error instead of the actual link - Ajax Search Pro just passes it towards to the hook.
That error object is causing the problem. Usually WordPress only returns an error object if there is an issue with the requested resource, in this case it seems like the link for one particular term (or more terms) is not possible to request, or it is not meant to be requested.
On the Search Sources -> Taxonomy Terms Search panel, check the list of the selected taxonomies to search there is definitely one or more selected that should not be. Some taxonomies are not meant to be returned as results (non-archive), so they can't have a link to them. They shouldn't show up on the list by default, but in some cases they can't be filtered out.
Make sure to check that list and deselect the ones that should not be shown as results:
That will resolve this issue.
I forgot - you also mentioned the PHP version, it is possible that there is a hook for the taxonomy term links somewhere else, which then bugs them out and wordpress catches it and returns an error when it's requested. Could be a deprecated function of some sort, which may not longer work on PHP 8.2.
Ajax Search Pro requests it via get_term_link()
core WP function, and that sent an error object instead of the link, which was then passed on to the WPML hook.
Hi ernestmarcinko, thanks for the response.
On the Search Sources -> Taxonomy Terms Search panel, check the list of the selected taxonomies to search there is definitely one or more selected that should not be. Some taxonomies are not meant to be returned as results (non-archive), so they can't have a link to them. They shouldn't show up on the list by default, but in some cases they can't be filtered out.
From the start, I did not enable taxonomy term search. I also just confirmed in the Taxonomy Terms Search Panel that there is no taxonomy selected to search (it's blank, just as seen in your screenshot above).
it is possible that there is a hook for the taxonomy term links somewhere else, which then bugs them out and wordpress catches it and returns an error when it's requested. Could be a deprecated function of some sort, which may not longer work on PHP 8.2.
Yes, I believe this is caused by breaking changes due to the upgrade to PHP 8. It's just that I don't know where the error lies because it involves 2 plugins and WordPress core itself. For now I will stick with PHP 7.4.
That error object is causing the problem. Usually WordPress only returns an error object if there is an issue with the requested resource, in this case it seems like the link for one particular term (or more terms) is not possible to request, or it is not meant to be requested.
Btw, in your opinion, is this kind of workaround (link below) related to this issue, and can it also be applied to ASP? At a glance, I saw that there was a similarity to the fatal error message in this case.
https://wpml.org/errata/the-events-calendar-fatal-error-on-translated-events-with-php-8/
From the start, I did not enable taxonomy term search. I also just confirmed in the Taxonomy Terms Search Panel that there is no taxonomy selected to search (it's blank, just as seen in your screenshot above). That is strange, because the error specifically originates from the Taxonomy search file, maybe it is the keyword suggestions then?
Can you please turn that off or deselect some taxonomies here:
But this feels like some sort of a WP core issue. Looking at that other one you linked, it is very similar and that workaround would work here too. However that is only a "bypass" and it's redundant, as it does not reveal why the link is returned as an error instead of like an empty string or something like that.
Either way, I am keeping this open and possibly add that workaround to address the issue. It is redundant, but at this point I think it's just easier to add those few lines, and let the WP core team figure out what's happening. This surely comes up to others as well, so it is likely going to be fixed in some time.
That is strange, because the error specifically originates from the Taxonomy search file, maybe it is the keyword suggestions then? Can you please turn that off or deselect some taxonomies here:
Sorry for my late reply.
Yes, I can confirm that by disabling the predictive results and keyword suggestions feature, ASP and WPML run normally in PHP 8.2. At least during a short observation after disabling the feature, I didn't see anything in the error_log.
Before this, I activated this feature with a keyword suggestion source that came from "post title".
Very good, thank you! I will look at the WP Core bugs list, maybe I can find something in relation. Either way, I am going to add an error check for all search types, just in case.
DEV TODO:
wp_is_error()
checks.It seems I spoke too quickly.
The search was able to run normally (with the previous feature disabled) before, but I again faced the same problem with an identical error_log as before. I don't understand why it used to work normally but doesn't anymore.
Currently, I'm back to using PHP 7.4.
@kswro All right, either way, the error check is going to fix this for sure. Thank you very much for all the feedback, it was very useful!
Describe the bug Search does not work when WPML compatibility feature is enabled in PHP 8.2 env (WordPress 6.4 recommended to run on PHP 8.1 or 8.2). Message that appears when searching: "The request failed. Please check your connection! Status: 500"
The issue does not appear in PHP 7.4
To Reproduce WPML Info & Config:
Ajax Search Pro Info & Config:
WordPress Info:
Steps to reproduce the behavior:
Expected behavior Search returns results as in PHP 7.4 env.
Desktop (please complete the following information):
Log
Additional context I contacted WPML support and this is their reply: https://wpml.org/forums/topic/wpml-and-ajax-search-pro-issues-in-php-8-2/