[wp-trac] [WordPress Trac] #34353: redirect_canonical() – Undefined indexes 'host' and 'scheme'

WordPress Trac noreply at wordpress.org
Fri Aug 29 13:05:11 UTC 2025


#34353: redirect_canonical() – Undefined indexes 'host' and 'scheme'
--------------------------------------+-----------------------------
 Reporter:  theamila                  |       Owner:  (none)
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  Future Release
Component:  Canonical                 |     Version:  4.3.1
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------

Comment (by mikemeinz):

 I temporarily added an **error_log($requested_url)** call to canonical.php
 to see if I could determine the cause.

 I found that, in some cases, the $requested_url was malformed.

 I added this after line 78 to verify that the $original array was
 populated correctly and if not exit the function.

 {{{#!php
 <?php
         if ((! isset( $original['host'])) || (! isset(
 $original['scheme'])) || (! isset( $original['path']))) {
                 return;
         }

 }}}

 Can someone submit this to be included in a future WordPress version?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/34353#comment:74>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list