[wp-trac] [WordPress Trac] #57427: WP_Locale doesn't initialize property arrays before using them

WordPress Trac noreply at wordpress.org
Mon Jan 9 14:51:12 UTC 2023


#57427: WP_Locale doesn't initialize property arrays before using them
--------------------------+-----------------------------
 Reporter:  tyxla         |       Owner:  hellofromTonya
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  6.2
Component:  I18N          |     Version:  6.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------------
Changes (by hellofromTonya):

 * owner:  (none) => hellofromTonya
 * status:  new => accepted


Comment:

 Though instantiated in `wp-settings.php`, within the class object itself,
 `WP_Locale` properties are being set in the `WP_Locale::init()` method
 (called from the constructor) ''before'' first being initialized as an
 array data type. I agree with the approach in
 [https://github.com/WordPress/wordpress-develop/pull/3824 PR 3824] as it
 reuses Core code designs and clearly communicates design intent at the
 property definition itself.

 I'd like to see a unit test added to the PR, which I will do today.

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


More information about the wp-trac mailing list