[wp-trac] [WordPress Trac] #55967: Scripts: Ensure path for JavaScript translations is always a string

WordPress Trac noreply at wordpress.org
Wed Sep 28 22:17:52 UTC 2022


#55967: Scripts: Ensure path for JavaScript translations is always a string
-----------------------------+-----------------------------
 Reporter:  ocean90          |       Owner:  SergeyBiryukov
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:  6.1
Component:  Script Loader    |     Version:
 Severity:  normal           |  Resolution:  fixed
 Keywords:  has-patch php81  |     Focuses:
-----------------------------+-----------------------------

Comment (by SergeyBiryukov):

 In [changeset:"54351" 54351]:
 {{{
 #!CommitTicketReference repository="" revision="54351"
 I18N: Use correct default value for JavaScript translations path.

 The `$path` parameter of some script translation functions had a default
 value of `null`, even though the parameter is documented as a string.

 This commit corrects the default value for `$path` in:
 * `WP_Dependency::set_translations()`
 * `WP_Scripts::set_translations()`
 * `wp_set_script_translations()`

 Additionally, this commit removes an `is_string()` check for `$path` in
 `load_script_textdomain()`. Now that the default value for `$path` in that
 function has also been corrected to an empty string instead of `null`,
 that check is no longer necessary, as it would ''hide'' an error which
 should be ''fixed'' (at the source of the problem) instead.

 Follow-up to [54349].

 Props jrf, johnjamesjacoby.
 See #55967, #55656.
 }}}

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


More information about the wp-trac mailing list