[wp-trac] [WordPress Trac] #57427: WP_Locale doesn't initialize property arrays before using them
WordPress Trac
noreply at wordpress.org
Fri Jan 6 13:46:03 UTC 2023
#57427: WP_Locale doesn't initialize property arrays before using them
--------------------------+---------------------
Reporter: tyxla | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.2
Component: I18N | Version: 6.1
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+---------------------
Comment (by tyxla):
I believe you're asking great questions!
> Does the code in question run earlier than that?
Yes, it appears so! It's worth noting that `WP_Locale` can be used in
other contexts also, like REST API requests or WP CLI, and there the load
order can be different, especially when the setup is customized.
> Would removing this warning make it harder to determine why the locale
data is not loaded?
I personally don't think so. If the locale data doesn't load, chasing why
that happens will be all the same with or without the warning, since its
place of occurrence doesn't hint to a newly introduced error.
> Should the code in question perhaps run later, when the locale data is
initialized?
Likely. However, my $0.02 are that `WP_Locale`, as a module, should be
abstracted in a way that allows it to work as a module, regardless of
where it's dropped. The fact is that if we take `WP_Locale` as a single
piece, and initialize it, it relies on external factors to set it up,
which may not always be the case; thus the warnings that we see. An easy
and painless way to ger around the warnings without affecting any other
functionality would be to add the default values, as proposed in the
related PR above.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57427#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list