Passer au contenu Passer à la barre latérale

Marqué : 

Ce sujet contient 0 réponse, a 1 voices.

Dernière mise à jour par romansS Il y a 1 année.

Assisté par: Noman.

Auteur Messages
octobre 8, 2024 à 12:41 pm #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 (lien caché) and passes it to trim() (lien caché) 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: