[wp-trac] [WordPress Trac] #60888: Fatal error when passing non-strings to `WP_Translation_Controller::load_file()`
WordPress Trac
noreply at wordpress.org
Tue Apr 30 09:45:55 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.3
Component: I18N | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests fixed- | Focuses:
major dev-reviewed |
-------------------------------------------------+-------------------------
Changes (by swissspidy):
* status: reopened => closed
* resolution: => fixed
Comment:
In [changeset:"58066" 58066]:
{{{
#!CommitTicketReference repository="" revision="58066"
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.
Merges [57925] to the 6.5 branch.
Reviewed by jorbin.
Props verygoode, swissspidy.
Fixes #60888.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60888#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list