[wp-trac] [WordPress Trac] #60888: Fatal error when passing non-strings to `WP_Translation_Controller::load_file()`

WordPress Trac noreply at wordpress.org
Thu Apr 4 13:54:31 UTC 2024


#60888: Fatal error when passing non-strings to
`WP_Translation_Controller::load_file()`
--------------------------------------+-------------------------
 Reporter:  swissspidy                |       Owner:  swissspidy
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.5.1
Component:  I18N                      |     Version:
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-------------------------
Changes (by swissspidy):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"57925" 57925]:
 {{{
 #!CommitTicketReference repository="" revision="57925"
 I18N: Bail early if an invalid text domain is passed to
 `load_textdomain()` et al.

 Some plugins pass invalid values such as `null` instead of a string, which
 has never been supported by WordPress (no translations are loaded) and was
 technically undefined behavior. With the introduction of the new l10n
 library in #59656, which has stricter type hints, this could end up
 causing warnings or even fatal errors.

 This change adds a deliberate short-circuit to `load_textdomain()` & co.
 to better handle such a case and document that it is not supported.

 Props verygoode, swissspidy.
 Fixes #60888.
 }}}

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


More information about the wp-trac mailing list