[wp-trac] [WordPress Trac] #45235: REST API: Setting _locale can cause fatal errors

WordPress Trac noreply at wordpress.org
Wed Oct 31 02:32:53 UTC 2018

#45235: REST API: Setting _locale can cause fatal errors
 Reporter:  pento         |       Owner:  danielbachhuber
     Type:  defect (bug)  |      Status:  closed
 Priority:  high          |   Milestone:  5.0
Component:  I18N          |     Version:  5.0
 Severity:  major         |  Resolution:  fixed
 Keywords:  needs-patch   |     Focuses:  rest-api
Changes (by danielbachhuber):

 * owner:  (none) => danielbachhuber
 * status:  new => closed
 * resolution:   => fixed


 In [changeset:"43846" 43846]:
 #!CommitTicketReference repository="" revision="43846"
 l10n: Avoid calling `is_user_logged_in()` in `determine_locale()`.

 `is_user_logged_in()` is a pluggable function, and loaded after plugins
 are loaded. If a plugin calls `__()` too early, `is_user_logged_in()` is
 missing and WordPress will fatal. `get_user_locale()` already handles this
 scenario for us, so it's safe to rely on exclusively.

 See #44758.
 Fixes #45235.

Ticket URL: <https://core.trac.wordpress.org/ticket/45235#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list