From 69c34467f5995105249b3945496f4b587c0696aa Mon Sep 17 00:00:00 2001 From: "K. Adam White" Date: Mon, 9 Oct 2023 15:03:41 +0100 Subject: [PATCH] 57512: Commit patch from 57512_with_tests_2.diff (adjusts comment formatting). --- src/wp-includes/load.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php index 77e17b3f8b877..520902cdd64ba 100644 --- a/src/wp-includes/load.php +++ b/src/wp-includes/load.php @@ -126,7 +126,12 @@ function wp_populate_basic_auth_from_authorization_header() { $token = substr( $header, 6 ); $userpass = base64_decode( $token ); - list( $user, $pass ) = explode( ':', $userpass ); + // There must be at least one colon in the string. + if ( ! str_contains( $userpass, ':' ) ) { + return; + } + + list( $user, $pass ) = explode( ':', $userpass, 2 ); // Now shove them in the proper keys where we're expecting later on. $_SERVER['PHP_AUTH_USER'] = $user;