This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing a fatal error when accessing the Pronamic plugin in the admin site, particularly when a custom post type has no posts, this might be due to a specific configuration issue.
Solution:
We have identified that the issue is not directly caused by WPML. However, setting
'hierarchical' => false
in the Pronamic Pay with Rabo Smart Pay for WooCommerce plugin's custom post type (CPT) registration can prevent this issue. This adjustment addresses the root of the problem by modifying how the CPT is handled.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Additionally, if you need further assistance, please open a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Tagged: Compatibility, Go Global Application, Not WPML issue
This topic contains 29 replies, has 5 voices.
Last updated by Diego Pereira 2 months, 2 weeks ago.
Assisted by: Waqas Bin Hasan.
Author | Posts |
---|---|
August 13, 2024 at 7:45 am #16064819 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. I analyzed further and was able to reproduce the error. However, it only happens with "Pronamic Pay with Rabo Smart Pay for WooCommerce" plugin. Because I installed ACF (Advanced Custom Fields) plugin, created a new custom post type and it works just fine at hidden link (even without the solution purposed in https://wpml.org/forums/topic/crash-when-a-custom-post-type-has-no-posts/). So I'll recommend that you use the proposed solution: - Edit /wp-content/plugins/sitepress-multilingual-cms/menu/post-menus/wpml-posts-listing-page.class file. if (empty($wp_query->posts)) return; - And save the file. Or alternatively there's another solution by our team on the same ticket at https://wpml.org/forums/topic/crash-when-a-custom-post-type-has-no-posts/#post-15259389. Because unfortunately "Pronamic Pay with Rabo Smart Pay for WooCommerce" is not compatible with WPML (https://wpml.org/plugin/). I recommend you to contact the plugin author and request a compatibility update. WPML offers very useful information for developers aiming to make their themes/plugins compatible. Please see https://wpml.org/documentation/support/ and https://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/ for details. Theme and plugin authors are welcome to join WPML’s Go Global program, which helps them make their code multilingual ready. Together with WPML’s compatibility team, they can test and confirm that their theme or plugin works with WPML. See https://wpml.org/documentation/support/go-global-program/ for details and you can refer your theme/plugin provider to this as well. |
August 13, 2024 at 7:54 am #16064930 | |
robbertv-5 |
Yes its only with Pronamic, that's why i created the stage. So why are we doing all this work, i hoped for the outcome to be that WPML ads a waterproof solution in the next coming update. I talked with Pronamic before and they say it's WPML that's causing it. Thank you for checking, but it all feels a waste of time and useless now? |
August 13, 2024 at 9:45 am #16065495 | |
Remco |
Hello, a Pronamic developer joining here. We were also unable to reproduce the error with a clean WPML and Pronamic Pay install (and also with the Redis plugin unable to reproduce the issue). But I'm honestly wondering if Waqas has actually read the original error message at all? > Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /wp-content/plugins/sitepress-multilingual-cms/menu/post-menus/wpml-posts-listing-page.class.php:26 The "sitepress-multilingual-cms" in the plugin path refers to the WPML plugin. Which indicates that the fatal error is coming from the WPML plugin for sure. In fact, the error message also tells us that in WPML something is "counted" which cannot be counted (a `null` value). If this value — in this case the `posts` property of a WP_Query object — is coming from WordPress itself, an object cache, the Pronamic Pay plugin or somewhere else is irrelevant: WPML is not handling the `null` value correctly. That is what the error message makes clear and what WPML developers need to resolve. To me, it is mind boggling that the topic at https://wpml.org/forums/topic/crash-when-a-custom-post-type-has-no-posts/ has been marked as "resolved" with a line of code for WPML users to fix the issue themselves if they come across this. Why not just fix issues in WPML for all users?! Asking developers to join a "Go Global program" to improve compatibility with these bugs in WPML and not taking any action yourself to resolve a simple bug in your plugin like the one from this topic (first reported in February in the other topic), sounds kind of strange. WordPress has a lot of filters and actions for developers to hook into and you use many of them, as a developer it is your responsibility to use them wisely and not break things or at least fix them ASAP if you accidentally do make a mistake. To help your developers fix this bug, you can use the following filter to reproduce the issue (I'm guessing a `null` return value for the `posts_pre_query` is also how the issue occurs on the site in question): > add_filter( 'posts_pre_query', '__return_null' ); This is not some strange code to only be able reproduce the error, `null` is a perfectly valid return value for this filter according to the documentation at https://developer.wordpress.org/reference/hooks/posts_pre_query/ : > Return an array of post data to short-circuit WP’s query, or `null` to allow WP to run its normal queries. I assume this can be resolved soon, as a possible fix is already available at the top of https://wpml.org/forums/topic/crash-when-a-custom-post-type-has-no-posts/ . User `robbertv-5` has put a lot of effort cooperating with you on this to help resolve the issue and improve this for all your users, but it is really really really disappointing to see how such a simple issue is handled. |
August 13, 2024 at 1:17 pm #16066586 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
I understand your concerns and I also understand that error points to WPML's code. However, I tried other than the said plugin, for example ACF (without any multilingual extension by WPML). ACF is a much popular plugin and does not run into the same issue. Anyways, given your concerns, I'll check with my team and 'll escalate as needed. This requires some more time. I'll update here accordingly. Thank you for your patience. |
August 13, 2024 at 1:46 pm #16066713 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. I've discussed with the team and 'll escalate the issue to our 2nd tier. For this I'll to create a package of your CW test site, as well as, to copy onto another CW site in our test servers.
|
August 13, 2024 at 2:39 pm #16066924 | |
robbertv-5 |
Yes, you can create a package of the test server. |
August 15, 2024 at 5:37 am #16072970 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for confirming, I've created a package and 've escalated the issue to our 2nd tier. Please keep your staging site up for a few more days, if not a problem. Although we'll replicate in our own CW test site, but there are chances if team needs to compare both environments. I'll keep you posted about the progress. |
August 15, 2024 at 9:13 am #16073643 | |
robbertv-5 |
Yes, i will wait for a few more days. |
August 15, 2024 at 11:40 am #16074165 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you, I'll keep you posted. |
August 23, 2024 at 7:05 am #16097353 | |
robbertv-5 |
Can i drop the staging site? |
August 23, 2024 at 7:55 am #16097509 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
I'll request just to wait till this weekend, because today the matter has been further escalated to our compatibility team. Apparently looks like the post type registration method in the said plugin has to do with the issue. Although everything is fine there but only it is being "hierarchical" is the problem. However, these are not the final findings. I'm just waiting for some more insights from the team. I'll update you as soon as there's more. Thank you for your patience and cooperation. |
August 27, 2024 at 8:50 am #16108392 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. The issue has been forwarded to our development team, who will review whether to implement a fix. However, we cannot give a timeframe for when this will be implemented. Please also consider following notes from the team:
|
August 29, 2024 at 5:02 am #16117462 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. Our dev team looked into this and determined that this issue is not directly caused by WPML and we will not take any changes regarding this issue on WPML Core. Please contact "Pronamic Pay with Rabo Smart Pay" and let them know that when their CPT is registered as non-hierarchical, this issue can be prevented. Please feel free to drop your staging site also. Thanks again. |
August 29, 2024 at 7:42 am #16117958 | |
Remco |
Haha, your support and dev keeps surprising us… `'hierarchical' => true` is a perfectly valid parameter according to https://developer.wordpress.org/reference/functions/register_post_type/ and still you dare claiming "this issue is not directly caused by WPML". We're not planning on making any changes in our plugin either, as the error message is not coming from our plugin. Looking forward to hear from you how you will resolve the bug in WPML for your customer, without your dev team willing to make any changes. |
August 29, 2024 at 1:18 pm #16120210 | |
Diego Pereira Supporter
Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello @Remco, this is Diego from the WPML Compatibility team. It seems that we had a mix-up in communication, so let me try to clarify. The related development ticket is still open in our system, we didn't close it definitively. What happened is that our team did a preliminary analysis and concluded that, although the error message is generated by WPML, the error does not originate there. So fixing just the code that triggers the message (just handling the null value there) would be more of a hack than a proper fix. The error would still be there and could break other parts of the code and other plugins. Please note that even though WPML is used on a large number of websites, we do not have many reports of this same issue (The other ticket mentioned was many months ago and was closed due to lack of customer feedback, so we were unable to investigate it further). I'm not blaming your plugin either. From what I understand, the problem mentioned here only occurs in a specific scenario, as the "enable Object Cache PRO" plugin also needs to be enabled. I also understand that setting 'hierarchical' => true` is a valid parameter. But in this specific scenario, this configuration is causing some kind of error and we are not sure why the payment gateway needs this setup. That's why we recommended this modification. Please let us know if we can be of any help. |