Home›Support›English Support›[Resolved] WPML_LS_Menu_Item throwing - Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of
[Resolved] WPML_LS_Menu_Item throwing - Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of
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.
Background of the issue:
I am trying to: Please reopen this ticket, I have supplied screenshots of where the issue lies and would like to submit a compatibility bug report.
Please try the following steps on your staging site and make sure the issue exists or not.
a) Backup your site first[Mandatory]
b) Switch for a moment to a WordPress default theme like 2024
c) Deactivate all the plugins that are not related to WPML except LearnDash LMS(or must required plugins to reproduce the issue)
d) Then check whether the issue exists or not
e) If the issue is gone, activate the plugins as a group of three or four to find which one has an interaction issue
f) Switch back to the original theme of the site
If the issue exists, please let us know the exact steps to reproduce it in your staging site.
The issue still persists and can be seen here: hidden link
```
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
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
- and If Learndash Integrity is active and runs has_shortcode using the "description" field of a menu item
Then it's always going to cause the error.
WPML sets the menu item description to null.
PHP throws a deprecation warning that str_contains() will no longer accept null in the future.
So it either needs to be patched in WPML now, or it will throw a fatal error in future versions of PHP.
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.
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.
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.
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.
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:
- A menu location in the theme
- A menu associated with the location
- WPML set to output the language switcher that menu.
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.
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.
Thank you for the feedback. We will inform you as soon as we receive an update from our developers about the release. Please wait.
--
Thanks!
Bigul
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.