Skip navigation

Помечено: 

Эта тема содержит 0 ответов, имеет 1 голос.

Последнее обновление: romansS 5 месяцев, 1 неделя назад.

При содействии: Noman.

Автор Записи
8 октября, 2024 на 12:41 пп #16265427

romansS

Background of the issue:
I am trying to address a minor issue in SitePress::user_lang_by_authcookie() that causes a deprecation warning on PHP 8.1 or later. Here is part of the code I am working with: if ( function_exists( 'wp_parse_auth_cookie' ) ) { $cookie_data = wp_parse_auth_cookie(); $username = isset( $cookie_data['username'] ) ? $cookie_data['username'] : null; } $user_obj = new WP_User( 0, $username ); Please notice that you're assigning null to $username if it is not set and then pass it to WP_User(). But this class expects the argument to be a string (скрытая ссылка) and passes it to trim() (скрытая ссылка) effectively causing a deprecation warning.

Symptoms:
Deprecation warning on PHP 8.1 or later due to passing null to WP_User() where a string is expected.

Questions: