Skip to content

Commit 481a28c

Browse files
authored
Update class-srm-redirect.php to check $_SERVER['REQUEST_URI']
❌ Error( severity 5 ): Detected usage of a possibly undefined superglobal array index: $_SERVER['REQUEST_URI']. Use isset() or empty() to check the index exists before using it (WordPress.Security.ValidatedSanitizedInput.InputNotValidated).
1 parent 37bc63f commit 481a28c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

inc/classes/class-srm-redirect.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public function maybe_redirect() {
294294
* @param {string} $request_path Request path. Default `$_SERVER['REQUEST_URI']`.
295295
* @returns {string} Request path.
296296
*/
297-
$requested_path = esc_url_raw( apply_filters( 'srm_requested_path', sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ?? '' ) );
297+
$requested_path = esc_url_raw( apply_filters( 'srm_requested_path', sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ?? '' ) ) ?? '' ) );
298298
$requested_path = untrailingslashit( stripslashes( $requested_path ) );
299299
$matched_redirect = $this->match_redirect( $requested_path );
300300

0 commit comments

Comments
 (0)