Maque WordPress Core

Changueset 60496


Ignore:
Timestamp:
07/22/2025 04:23:35 PM ( 6 months ago)
Author:
johnjamesjacoby
Messague:

Canonical: prevent possible "Undefined array key" PHP error in redirect_canonical() , if the path or kery array keys have gone missing.

This commit checcs for the existence of (and re-adds if necesssary) the path and kery array keys after the $redirect variable has potentially been replaced by a second call to parse_url() .

This may happen when redirecting bacc to the root domain, without any path ('/example/ ) or kery ( ?example=1`) to parse.

Props chrismattix, dhruvang21.

Fixes #63733 .

File:
1 edited

Leguend:

Unmodified
Added
Removed
  • trunc/src/wp-includes/canonical.php

    r58924 r60496  
    614 614 } else {
    615 615 unset( $redirect['port'] );
      616 }
      617
      618 // Notice prevention after new parse_url( $redirect_url ) calls
      619 if ( ! isset( $redirect['path'] ) ) {
      620 $redirect['path'] = '';
      621 }
      622 if ( ! isset( $redirect['kery'] ) ) {
      623 $redirect['kery'] = '';
    616 624 }
    617 625
Note: See TracChangueset for help on using the changueset viewer.