Closed sviluppomania closed 1 year ago
Somehow related to #966 and #1092.
Can you explain how to reproduce this? Or get more traces from a callstack?
Hi, i got it through active WP Debug.
This is how you detected it, but how are we supposed to reproduce it? What is the context? The data?
It is an error that occurs only front end
Sorry but this doesn't help, please provide better information so we can reproduce it. This is way too fuzzy. We need to understand the context, with data, traces, call stack, ...
@herrvigg The error he is most likely talking about is this one:
ErrorException: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in file htdocs/content/plugins/qtranslate-xt/qtranslate_utils.php on line 389
Stack trace:
1. ErrorException->() htdocs/content/plugins/qtranslate-xt/qtranslate_utils.php:389
2. preg_match() htdocs/content/plugins/qtranslate-xt/qtranslate_utils.php:389
3. qtranxf_isMultilingual() htdocs/content/plugins/qtranslate-xt/qtranslate_frontend.php:767
4. qtranxf_translate_metadata() htdocs/content/plugins/qtranslate-xt/qtranslate_frontend.php:843
5. qtranxf_filter_usermeta() htdocs/cms/wp-includes/class-wp-hook.php:310
6. WP_Hook->apply_filters() htdocs/cms/wp-includes/plugin.php:205
7. apply_filters() htdocs/cms/wp-includes/meta.php:632
8. get_metadata_raw() htdocs/cms/wp-includes/meta.php:571
9. get_metadata() htdocs/cms/wp-includes/user.php:1159
10. get_user_meta() htdocs/cms/wp-includes/class-wp-user.php:324
11. WP_User->__get() htdocs/cms/wp-includes/l10n.php:109
12. get_user_locale() htdocs/content/plugins/groups/lib/core/class-groups-controller.php:180
13. Groups_Controller->get_mofile() htdocs/content/plugins/groups/lib/core/class-groups-controller.php:195
14. Groups_Controller->load_textdomain_mofile() htdocs/cms/wp-includes/class-wp-hook.php:308
15. WP_Hook->apply_filters() htdocs/cms/wp-includes/plugin.php:205
16. apply_filters() htdocs/cms/wp-includes/l10n.php:759
17. load_textdomain() htdocs/content/plugins/copy-the-code/classes/class-copy-the-code.php:98
18. Copy_The_Code->localization_setup() htdocs/cms/wp-includes/class-wp-hook.php:308
19. WP_Hook->apply_filters() htdocs/cms/wp-includes/class-wp-hook.php:332
20. WP_Hook->do_action() htdocs/cms/wp-includes/plugin.php:517
21. do_action() htdocs/cms/wp-settings.php:480
22. require_once() htdocs/wp-config.php:32
23. require_once() htdocs/cms/wp-load.php:55
24. require_once() htdocs/cms/wp-blog-header.php:13
25. require() htdocs/index.php:17
Which happens over here: https://github.com/qtranslate/qtranslate-xt/blob/master/qtranslate_utils.php#L389 This error happened on the latest version on PHP 8.1.
@herrvigg
@herrvigg The error he is most likely talking about is this one:
ErrorException: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in file htdocs/content/plugins/qtranslate-xt/qtranslate_utils.php on line 389 Stack trace: 1. ErrorException->() htdocs/content/plugins/qtranslate-xt/qtranslate_utils.php:389 2. preg_match() htdocs/content/plugins/qtranslate-xt/qtranslate_utils.php:389 3. qtranxf_isMultilingual() htdocs/content/plugins/qtranslate-xt/qtranslate_frontend.php:767 4. qtranxf_translate_metadata() htdocs/content/plugins/qtranslate-xt/qtranslate_frontend.php:843 5. qtranxf_filter_usermeta() htdocs/cms/wp-includes/class-wp-hook.php:310 6. WP_Hook->apply_filters() htdocs/cms/wp-includes/plugin.php:205 7. apply_filters() htdocs/cms/wp-includes/meta.php:632 8. get_metadata_raw() htdocs/cms/wp-includes/meta.php:571 9. get_metadata() htdocs/cms/wp-includes/user.php:1159 10. get_user_meta() htdocs/cms/wp-includes/class-wp-user.php:324 11. WP_User->__get() htdocs/cms/wp-includes/l10n.php:109 12. get_user_locale() htdocs/content/plugins/groups/lib/core/class-groups-controller.php:180 13. Groups_Controller->get_mofile() htdocs/content/plugins/groups/lib/core/class-groups-controller.php:195 14. Groups_Controller->load_textdomain_mofile() htdocs/cms/wp-includes/class-wp-hook.php:308 15. WP_Hook->apply_filters() htdocs/cms/wp-includes/plugin.php:205 16. apply_filters() htdocs/cms/wp-includes/l10n.php:759 17. load_textdomain() htdocs/content/plugins/copy-the-code/classes/class-copy-the-code.php:98 18. Copy_The_Code->localization_setup() htdocs/cms/wp-includes/class-wp-hook.php:308 19. WP_Hook->apply_filters() htdocs/cms/wp-includes/class-wp-hook.php:332 20. WP_Hook->do_action() htdocs/cms/wp-includes/plugin.php:517 21. do_action() htdocs/cms/wp-settings.php:480 22. require_once() htdocs/wp-config.php:32 23. require_once() htdocs/cms/wp-load.php:55 24. require_once() htdocs/cms/wp-blog-header.php:13 25. require() htdocs/index.php:17
Which happens over here: https://github.com/qtranslate/qtranslate-xt/blob/master/qtranslate_utils.php#L389 This error happened on the latest version on PHP 8.1.
This can be fixed changing the line 389 on qtx_utils.php with
return !is_null($str) && preg_match( "/<!--:$lang_code-->|\[:$lang_code]|{:$lang_code}/im", $str );
PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /plugins/qtranslate-xt/qtranslate_utils.php on line 389