[wp-trac] [WordPress Trac] #29122: Trailing slash in theme Domain Path header causes double slashes in path

WordPress Trac noreply at wordpress.org
Tue Aug 5 19:32:14 UTC 2014


#29122: Trailing slash in theme Domain Path header causes double slashes in path
--------------------------+-----------------------------
 Reporter:  bradyvercher  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The Domain Path header in themes is used to load the theme's translation
 files in `WP_Theme::load_textdomain()` when it is inactive.

 The [https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes
 /class-wp-theme.php#L1062 default value] is `/languages` without a
 trailing slash and is appended to the theme directory, which is then
 [https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-
 includes/l10n.php#L639 prepended to the MO file] in
 `load_theme_textdomain()`.

 If the Domain Path header has a trailing slash (ex: `/languages/`), the
 path ends up with double slashes. I'm not sure it's actually documented
 anywhere that the header shouldn't have a trailing slash, many of the
 popular themes in the directory use a trailing slash, and even the
 Automattic [https://github.com/Automattic/vip-
 scanner/blob/0e874e100ee191d2157441a15dbf72b52212f4ea/vip-
 scanner/checks/LanguagePacksCheck.php#L49 VIP Scanner plugin] requires it
 to have one.

 The `load_plugin_textdomain()` trims trailing slashes in various places to
 account for this. The attached patch does the same for
 `load_theme_textdomain()`.

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


More information about the wp-trac mailing list