WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 3 weeks ago

#46387 reviewing defect (bug)

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

Reported by: tditlu Owned by: SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: trunk
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

If WP_CONTENT_URL is set to a root path e.g. http://example.com not http://example.com/wp-content (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:
https://github.com/WordPress/gutenberg/issues/12670
https://github.com/wordplate/wordplate/issues/221

Attachments (3)

46387.diff (0 bytes) - added by odminstudios 6 weeks ago.
46387.2.diff (0 bytes) - added by odminstudios 6 weeks ago.
46387.3.diff (508 bytes) - added by odminstudios 6 weeks ago.

Download all attachments as: .zip

Change History (10)

#1 @swissspidy
4 months ago

  • Component changed from Cron API to I18N

#2 @SergeyBiryukov
3 months ago

#46672 was marked as a duplicate.

#3 @tditlu
6 weeks ago

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

@odminstudios
6 weeks ago

@odminstudios
6 weeks ago

@odminstudios
6 weeks ago

#4 @odminstudios
6 weeks 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
3 weeks ago

I had this issue on a local site using localhost url. I applied https://core.trac.wordpress.org/attachment/ticket/46387/46387.3.diff from @odminstudios The notice was no longer present after applying patch.

#6 @SergeyBiryukov
3 weeks ago

  • Milestone changed from Awaiting Review to 5.3

#7 @SergeyBiryukov
3 weeks ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing
Note: See TracTickets for help on using tickets.