• Resolved Maxime Michaud

    (@maximemichaud)


    Hello,

    I am currently running PHP 8.1 on my WordPress site and am still encountering multiple PHP deprecation warnings with the latest version of the Weglot plugin, despite previous resolutions. These warnings concern the use of null values in functions that expect string parameters, indicating ongoing compatibility issues with PHP.

    Here are the specific log entries indicating deprecation:

    PHP Deprecated:  preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/*****/wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/Url.php on line 292
    PHP Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in /var/www/*****/wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Parser/Parser.php on line 561
    PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/*****/wp-content/plugins/weglot/src/services/class-request-url-service-weglot.php on line 65
    PHP Warning: Undefined array key "source_before_callback" in /var/www/*****/wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Parser/Parser.php on line 561

    Request: Could the Weglot development team please re-investigate these deprecation warnings and consider further updates to enhance compatibility with newer PHP versions? Addressing these persistent issues is crucial for ensuring that the plugin remains functional and efficient with future PHP releases.

    Thank you for your attention to this matter. We have +10GB debug file with 99% Weglot.

    Previous Issue : https://www.ads-software.com/support/topic/deprecated-php-functions-in-weglot-plugin/

    You can send us the corrected file, and we will apply it and then wait for the official release. We have automatic updates enabled.

    Thank you!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Edson Galina Fortes

    (@glx77)

    Hi @maximemichaud ,

    hope you’re fine. Sorry for the issue you’re facing.
    Can you try with the future 4.2.9 version here : https://we.tl/t-EL795u2X4u
    On this version we work to reach the level 6 PHPStan and you should not have error any more. Don’t hesitate if you have feedbacks or question

    Regards

    Thread Starter Maxime Michaud

    (@maximemichaud)

    Hello, thanks for the quick response, we’ve implemented it.

    Unfortunately, it doesn’t seem to resolve the issue.
    It only changed the log format, making it a bit harder to diagnose, but the issue remains similar.

    [12-Sep-2024 07:04:51 UTC] PHP Deprecated:  strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/*****/wp-includes/functions.php on line 7300
    [12-Sep-2024 07:04:51 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/*****/wp-includes/functions.php on line 2189
    [12-Sep-2024 07:04:51 UTC] PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/*****/wp-includes/functions.php on line 7300
    [12-Sep-2024 07:04:51 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/*****/wp-includes/functions.php on line 2189
    [12-Sep-2024 07:05:25 UTC] PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/*****/wp-includes/functions.php on line 7300
    [12-Sep-2024 07:05:25 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/*****/wp-includes/functions.php on line 2189

    These are not errors, but deprecation notices, and they tend to spam quite a lot. ??

    Plugin Contributor Edson Galina Fortes

    (@glx77)

    Hello @maximemichaud ,

    thanks for your reply it’s help. In the first log you’ve have sending the deprecation come from Weglot file but in the last you’ve send it come from /var/www/*****/wp-includes/functions.php on line 7300. Is it normal ?
    If you prefer, you can reach the issue to [email protected] and mention me (Edson). It able me ask for dump of your website to make local test to debug it

    Regards

    Thread Starter Maxime Michaud

    (@maximemichaud)

    Hello,

    To clarify, I am not a WordPress developer, but it appears that the str_replace function is being used specifically by Weglot. After updating the plugin (4.2.9), this log started to appear again and was the first noticeable one. While it could be a coincidence and potentially related to something else, it seems unlikely.

    We will indeed need to contact support for another issue, which is more of an inconvenience regarding a translation exclusion. It would be great if you could review our latest logs, check this point, and get back to us with any insights.

    Thank you for your assistance.

    Plugin Contributor Edson Galina Fortes

    (@glx77)

    Hello,

    thanks for your reply. Yes i’m on it, i’ll try to replicate on my side. If you can make a last test to be sure ? Can you confirm you don’t have log anymore when Weglot is deactivate ?

    Regards

    Thread Starter Maxime Michaud

    (@maximemichaud)

    Hello,

    Well, I tested it in production (oops) a few minutes ago, it seems that the issue persists, but I don’t see what could also be using preg_replace. I deactivated the plugin, didn’t clear the object cache, but it seemed to be properly deactivated, and it doesn’t seem to be caused by that. Is there a way to isolate the logs differently?

    Maybe it could be another plugin on your side. Did you find anything?

    Plugin Contributor Edson Galina Fortes

    (@glx77)

    Hi @maximemichaud ,

    thanks for your reply. So to be sure, when you deactivate Weglot plugin the error persist ? In that case, the error can be due to another plugin ou your side. If Weglot is deactivated, our code is not launch any more on your website so we can deduce that’s it’s not the source of error. Can you try deactivate other plugin one by one ?

    Thread Starter Maxime Michaud

    (@maximemichaud)

    Yes, it doesn’t seem to come from Weglot based on its logs. I have an idea of some plugins that could be causing this, but it needs to be investigated more thoroughly. The plugins I suspect might need to be replaced eventually.

    That said, it’s great that the Weglot logs have been resolved; it makes the logs a lot more visible ?? And no, I can’t deactivate it. I disabled Weglot in the night, but I won’t risk it with over 1000 orders per day for the others. And the staging is outdated at the moment.

    Plugin Contributor Edson Galina Fortes

    (@glx77)

    Ha ok good, don’t hesitate if you need more help ;). To find the plugin cause the log may you can replicate your website in local or in a staging env ?
    Regards

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.