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: Exception
This topic contains 9 replies, has 2 voices.
Last updated by Andrey 1 year, 7 months ago.
Assisted by: Andrey.
Author | Posts |
---|---|
October 11, 2023 at 12:51 pm #14559591 | |
marcH-23 |
Hi, I am trying to go to the WP login page with the /wp-admin URL on my local website without already being connected. WP_DEBUG is set to true in the wp-config.php file. My WPML plugin is on 4.6.5 version and WP in 6.3.1. I expected to see the login page without errors but instead i got this warning : Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in wp-includes/class-wp-user.php on line 211. While traveling through the error Stack, I found that this file is problematic at line 653 : sitepress-multilingual-cms/sitepress.class.php. The variable $username is defined with an empty string on the line 650 but if username is not found in cookie datas, the $username variable is set to null. That cause error this error. Is it possible to replace this code : $username = ''; if ( function_exists( 'wp_parse_auth_cookie' ) ) { $cookie_data = wp_parse_auth_cookie(); $username = isset( $cookie_data['username'] ) ? $cookie_data['username'] : null; } by this ? $username = ''; if ( function_exists( 'wp_parse_auth_cookie' ) ) { $cookie_data = wp_parse_auth_cookie(); $username = isset( $cookie_data['username'] ) ? $cookie_data['username'] : ''; } It fix the error for me but if i update your plugin on the next release, i probably got the same error again cause my fix will be erased. (This code is the same on the current last version of WPML plugin 4.6.6) Thanks in advance. |
October 11, 2023 at 7:41 pm #14561777 | |
Andrey WPML Supporter since 06/2013 Languages: English (English ) Russian (Русский ) Timezone: Europe/Kyiv (GMT+03:00) |
Even though the code is the same, it could be fixed in the other place of the plugin. I encourage you to update WPML to the latest version and inform us about the results. How to register WPML to receive automated updates: |
October 12, 2023 at 7:38 am #14563259 | |
marcH-23 |
The code on the last version have the same problem. The update did not correct the problem. It's the same error and $username on line 653 is defined to null if nothing is found in cookie datas (as in the previous version). This error is only present since PHP 8.1. |
October 12, 2023 at 8:34 am #14563901 | |
Andrey WPML Supporter since 06/2013 Languages: English (English ) Russian (Русский ) Timezone: Europe/Kyiv (GMT+03:00) |
I’ll need a little more information to see what’s happening here. Do you still have this error if you temporarily deactivate all the plugins except WPML? What are the results with any default theme? |
October 13, 2023 at 10:19 am #14571933 | |
marcH-23 |
Yes i still have the error if i disable all plugins except : If i test with a default theme (Twenty Twenty-Three Version: 1.2) i still have the error (with all plugin disabled except WPML). If i disable the WPML plugins, the error disapear. The error only occurs in offline mode when I enter the URL /wp-admin. The /wp-login.php works. |
October 13, 2023 at 1:43 pm #14573825 | |
Andrey WPML Supporter since 06/2013 Languages: English (English ) Russian (Русский ) Timezone: Europe/Kyiv (GMT+03:00) |
Thank you for the update. Could you clarify "The error only occurs in offline mode"? Would it be possible for you to share the access details so I can check the error? I couldn't replicate the issue on the fresh installation. |
October 13, 2023 at 2:45 pm #14574185 | |
marcH-23 |
Yes : |
October 16, 2023 at 7:06 pm #14588311 | |
Andrey WPML Supporter since 06/2013 Languages: English (English ) Russian (Русский ) Timezone: Europe/Kyiv (GMT+03:00) |
Thank you for the explanation. I need to request temporary access (wp-admin and FTP) to your site – preferably to a test site where the problem has been replicated if possible – in order to be of better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it. |
October 20, 2023 at 9:04 am #14622095 | |
marcH-23 |
I finally can't provide you a staging environment with the error, sorry. I test a fix explained in my first message and it work but the new 4.6.7 does not have it so on the configuration listed above, I still have the error. |
October 23, 2023 at 12:24 pm #14637967 | |
Andrey WPML Supporter since 06/2013 Languages: English (English ) Russian (Русский ) Timezone: Europe/Kyiv (GMT+03:00) |
No problem. Thank you for your feedback. I was able to reproduce the issue using your steps and have reported it to our team. I hope it will be addressed in future releases. |