This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is experiencing a deprecated warning with
Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated
when using WPML with PHP 8.2. The issue seems related to a compatibility problem between LearnDash and WPML.
Solution:
We recommend reproducing the issue on a clean staging site with only WPML and LearnDash LMS activated. If the issue persists, follow these steps:
1. Backup your site.
2. Switch to a default WordPress theme temporarily.
3. Deactivate all unrelated plugins.
4. Check if the issue still exists.
5. Reactivate plugins in groups to identify the problematic one.
6. Switch back to your original theme.
If you identify the plugin causing the issue, you can apply a temporary patch provided by the client. Additionally, our developers are aware of this issue with PHP 8.2 and are working on a fix expected in WPML version 4.7. Meanwhile, to avoid displaying errors to site visitors, disable debug mode by adding
define('WP_DEBUG_DISPLAY', false);
to your wp-config.php file.
For more details on related issues, please visit this errata page.
If this solution does not resolve your issue or seems irrelevant, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.
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: Bug
This topic contains 10 replies, has 2 voices.
Last updated by Bigul 5 months ago.
Assisted by: Bigul.
Author | Posts |
---|---|
June 28, 2024 at 1:16 pm #15852205 | |
johnS-9 |
Background of the issue: Symptoms: Questions: |
June 30, 2024 at 8:24 am #15861717 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hello, Please try the following steps on your staging site and make sure the issue exists or not. a) Backup your site first[Mandatory] If the issue exists, please let us know the exact steps to reproduce it in your staging site. -- Bigul |
July 3, 2024 at 7:07 am #15881148 | |
johnS-9 |
Hi, The issue still persists and can be seen here: ``` Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/1284734.cloudwaysapps.com/amkmnpybyc/public_html/wp-includes/shortcodes.php on line 150 It matches with the step-debugging info I've provided above, it doesn't matter what the theme or other plugins there are. - If WPML is active with a menu based language switcher Then it's always going to cause the error. WPML sets the menu item description to null. So it either needs to be patched in WPML now, or it will throw a fatal error in future versions of PHP. |
July 3, 2024 at 8:18 am #15882125 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hello, Thank you for the updates. The site is asking for authentication credentials - hidden link So a couple of requests for tracking this bug. 1) Please let us know the exact steps to reproduce the issue on your site. Specially for the better understanding of the following. If Learndash Integrity is active and runs has_shortcode using the "description" field of a menu item 2) Please fill the private details fields after a full site backup. I would like to access the admin area of your site for further checking. Refer to the following links for more details about our private information sharing policies. hidden link Also, please allow me to make a duplicator copy of your site using the Duplicator plugin(https://wordpress.org/plugins/duplicator/) for debugging the issue on my local server. So we can troubleshoot the issue without affecting your site. -- Bigul |
July 3, 2024 at 4:47 pm #15886083 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hello, Thank you for the login information and details. I made a copy of the site. We will debug it further and get back to you as soon as possible. Please wait. -- Bigul |
July 4, 2024 at 1:39 pm #15892393 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hello, I can reproduce the issue on my local copy. But it works fine with the default theme. So consulting with our team for an expert opinion. We will get back to you soon. Please wait. -- Bigul |
July 4, 2024 at 1:42 pm #15892439 | |
johnS-9 |
Hi Bigul, Thanks for the update! The code backtrace / functions that are running all seemed to be Learndash or WPML if I'm remembering correctly. In your default theme do you have: Many thanks |
July 4, 2024 at 5:04 pm #15893448 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hello, Thank you for the updates. I can reproduce the issue with the 2021 theme. But it looks like a conflict with the PHP 8.2 version and is related to the following ticket. https://wpml.org/de/forums/topic/php-deprecated-creation-of-dynamic-property-wpml_ls/ It is expected to fix in the future version of WPML. I will check with our development team and get back to you soon. Please wait. -- Bigul |
July 5, 2024 at 11:06 am #15898130 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hello, Our developers confirmed this is a known issue while using the PHP 8.2 version and is expected to be fixed in the upcoming version of WPML(4.7). It is in the QA stage now. This will not affect the site's functioning. Refer to the following related errata URL for more details. We can avoid showing unwanted warnings and errors to the site visitors by disabling debug mode in WordPress. This is a recommended practice to prevent the warnings. Please edit your wp-config.php file and include this line to disable WordPress Debug Mode. define( 'WP_DEBUG_DISPLAY', false ); We will get back to you soon when we have an update about the release from our developers. A related ticket - https://wpml.org/forums/topic/php-8-2-upgrade-throwing-deprecated-warning/#post-14395041 -- Bigul |
July 5, 2024 at 11:08 am #15898131 | |
johnS-9 |
Thanks Bigul, That's fine, mainly I wanted to flag the issue so it can get patched. (Debug mode is always off on the live site!). Kind regards, |
July 5, 2024 at 4:51 pm #15899519 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hello, Thank you for the feedback. We will inform you as soon as we receive an update from our developers about the release. Please wait. -- Bigul |