Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#46387 closed defect (bug) (fixed)

Undefined index notice in wp-includes/l10n.php on line 950

Reported by: tditlu's profile tditlu Owned by: ocean90's profile ocean90
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.0
Component: I18N Keywords: has-patch
Focuses: Cc:


If WP_CONTENT_URL is set to a root path e.g. not (Which boilerplate frameworks like Bedrock & WordPlate do), the return object from wp_parse_url doesn't include a path value.

Adding a check if path is set in load_script_textdomain after wp_parse_url would solve this issue:

// Added to wp-includes/l10n.php, line 947
if ( empty( $content_url['path'] ) ) {
    $content_url['path'] = '/';

Related to these issues:

Attachments (3)

46387.diff (0 bytes) - added by odminstudios 5 years ago.
46387.2.diff (0 bytes) - added by odminstudios 5 years ago.
46387.3.diff (508 bytes) - added by odminstudios 5 years ago.

Download all attachments as: .zip

Change History (12)

#1 @swissspidy
5 years ago

  • Component changed from Cron API to I18N

#2 @SergeyBiryukov
5 years ago

#46672 was marked as a duplicate.

#3 @tditlu
5 years ago

Is there anything I could do to speed up implementing this fix?

5 years ago

5 years ago

5 years ago

#4 @odminstudios
5 years ago

  • Keywords has-patch added
  • Version set to trunk

Added a check if $content_urlpath? exists.
This should solve issues when content_url() returns no paths.

Please use 46387.3.diff, previous 2 are empty

#5 @Shelob9
5 years ago

I had this issue on a local site using localhost url. I applied from @odminstudios The notice was no longer present after applying patch.

#6 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.3

#7 @SergeyBiryukov
5 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#8 @ocean90
5 years ago

  • Owner changed from SergeyBiryukov to ocean90
  • Status changed from reviewing to accepted
  • Version changed from trunk to 5.0

#46336 includes a fix for this as well.

#9 @ocean90
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 45685:

I18N: Add support for custom WP_PLUGIN_URL in load_script_textdomain().

Plugins may not be on the same host/path as the rest of the content. To support loading translations for this setup check if the script source matches plugins_url().
Also fixes an undefined index notice when a custom content URL has no path.

Props odminstudios, ocean90.
Fixes #46336, #46387.

Note: See TracTickets for help on using tickets.