Deprecated: strpos(): Passing null to parameter
-
With PHP 8.2, on all the subpages of Tools > Import (for instance /wp-admin/admin.php?import=wordpress), I get this message:
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php on line 146After investigation, I have found that in the file wp-content\plugins\woocommerce\src\Internal\Admin\Orders\PageController.php on line 134, we see:
global $plugin_pageThe problem is that the variable $plugin_page isn’t defined on the Tools > Import pages.
Is it possible to fix it?
-
Hello Kerfred
Thank you for contacting WooCommerce support and detailing the issue you have encountered with PHP 8.2 and the deprecation message appearing on the Tools > Import subpages.
I have a site currently running a WooCommerce site on PHP version 8.2.15 and have tested the Tools > Import > WordPress process, but I was unable to replicate the error you described. This suggests there may be specific conditions on your site that are contributing to this issue.
To gain a better understanding of your setup and assist you more effectively, could I kindly ask you to send a copy of your site’s System Status Report? This information will provide a comprehensive view of the environment in which your WooCommerce installation is running, which is crucial for troubleshooting the issue.
Here is how you can obtain and share the System Status Report:
1. Navigate to WooCommerce > Status within your WordPress dashboard.
2. Click on Get system report at the top of the page.
3. Then click on Copy for support to copy the entire report to your clipboard.After copying the report, please paste it into a new Gist at https://gist.github.com. Once you have created the Gist, you can simply paste the Gist link here in your reply.
This will allow me to review your site’s configurations, active plugins, themes, and other pertinent details that may help us identify the cause of the issue.
I look forward to receiving your System Status Report to move forward with a solution. 🙂
Best regards.
Here is my WooCommerce status: https://gist.github.com/Kerfred/396f39bf6cc87cc812b93d847c605786
I have narrowed the problem. It happens only when HPOS is enabled.
Steps to reproduce the issue:
- Set define(‘WP_DEBUG’, true); in wp-config.php
- Install and activate WooCommerce
- Install and activate FG Joomla to WordPress https://ww.wp.xz.cn/plugins/fg-joomla-to-wordpress/
- Enable HPOS in the WooCommerce Advanced settings
- Go to Tools > Import > Joomla (FG)
You should see this message at the top of the screen:
Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php on line 146
Thank you for sharing the findings here, @kerfred.
How about interchanging the last two steps? (therefore, leaving HPOS activation last)
Should the error message appear, after proceeding with step 3 (from the bullet points above), or after running the Joomla importer, that would point to an issue with the FG Joomla to WordPress plugin.
In such case, feel free to reach out to its support channel (linked here), as they would be in a better position to assist you.
I hope this is helpful! Please let us know if you have any further questions or concerns.
We will be happy to help you further.The deprecated message is displayed at the top of the Import screen and only on this screen. It is displayed before running the import.
For information, I am the owner of the plugin FG Joomla to WordPress.
Thank you for elaborating further on this, @kerfred.
The deprecated message is displayed at the top of the Import screen and only on this screen. It is displayed before running the import.
From what I gather, the Import step comes after activating HPOS (per the steps linked here), while compatibility with HPOS is not declared in the plugin’s changelog.
Just to clarify, is the plugin already HPOS compatible (a version you are able to test with, as its owner), and the message displays anyway, or otherwise?
For information, I am the owner of the plugin FG Joomla to WordPress.
A pleasure to make your acquaintance!
My plugin FG Joomla to WordPress has no relation with WooCommerce. It doesn’t call any WooCommerce function. So it doesn’t have to declare compatibility with HPOS.
Hi @kerfred,
I understand your plugin is designed to migrate content from Joomla to WordPress and does not interact with WooCommerce or require any WooCommerce functions. As such, it doesn’t need to declare compatibility with HPOS.
As the plugin works with the HPOS feature turned off, I suggest leaving the feature off when performing any migrations from Joomla to WordPress.
Seriously?
I can’t believe that you advise every user that uses both WooCommerce and FG Joomla to WordPress to disable HPOS! Is it really that you advise?
Your solution will just hide the message but won’t solve the issue.Moreover, the problem is the same with the migration plugins that require WooCommerce: FG PrestaShop to WooCommerce, FG Magento to WooCommerce, FG OpenCart to WooCommerce.
Could you escalate this issue to a developer?
Or do you prefer that I send you a patch for WooCommerce that fixes this issue?Hi @kerfred,
Our main goal is to ensure all WooCommerce features and functionalities work seamlessly with your setup. Clearly, the issue you’re encountering is causing some inconvenience, and we certainly want to address it.
I recommend you create an issue on our GitHub repo and include your patch. This way, our developer team can review it and provide further insights.
I hope this clarifies your concern. If you have any other questions, feel free to ask.
Done. Here is the issue with the patch: https://github.com/woocommerce/woocommerce/issues/44598
Please note that this issue does not concern only me, but all users that use both WooCommerce and a migration plugin like FG Joomla to WordPress.
Hi @kerfred,
We appreciate your patience and understanding as our team looks into this issue.
Thanks.
The topic ‘Deprecated: strpos(): Passing null to parameter’ is closed to new replies.