[wp-trac] [WordPress Trac] #49145: Undefined index: host in/wp-includes/l10n.php on line 989, suggested fix

WordPress Trac noreply at wordpress.org
Tue Jan 7 15:06:55 UTC 2020


#49145: Undefined index: host in/wp-includes/l10n.php on line 989, suggested fix
--------------------------+-----------------------------
 Reporter:  SeBsZ         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.3.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 We're using WordPress 5.3.2 and I'm getting a lot of notices: "Notice:
 Undefined index: host" in l10n.php on line 989:

 {{{#!php
 } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] ===
 $site_url['host'] ) {
 }}}

 The cause in our case, is that $site_url does not have a 'host' index. I'd
 like to suggest that instead of only checking whether
 `$src_url['host']` is set, also check whether `$site_url['host']` is set.

 We have a filter on site_url() which makes all URLs relative. This is what
 causes 'host' not to be set. Regardless of the cause though, I don't think
 l10n.php should generate a notice in this case.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49145>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list