[wp-trac] [WordPress Trac] #58788: Call to undefined function get_locale() in admin.php

WordPress Trac noreply at wordpress.org
Tue Jul 11 22:14:11 UTC 2023


#58788: Call to undefined function get_locale() in admin.php
----------------------------------------------+----------------------------
 Reporter:  zyphlar                           |      Owner:  (none)
     Type:  defect (bug)                      |     Status:  new
 Priority:  normal                            |  Milestone:  Awaiting
                                              |  Review
Component:  Administration                    |    Version:  trunk
 Severity:  normal                            |   Keywords:
  Focuses:  administration, coding-standards  |
----------------------------------------------+----------------------------
 On `/wp-admin/includes/admin.php` line 16, if admin.php is accessed
 directly or via any path that doesn't have the proper includes, the
 following error is emitted:

 `Fatal error: Uncaught Error: Call to undefined function get_locale() in
 /var/www/html/wp-admin/includes/admin.php:16 Stack trace: #0 {main} thrown
 in /var/www/html/wp-admin/includes/admin.php on line 16`

 Although it's not crucial, bots, scrapers, malicious users, and
 misconfigured aspects of WordPress or plugins can trigger this error
 making admins think that something is broken with the website. If
 something shouldn't be called directly, or only with certain parameters,
 that should be coded as such without assumption.

 Bug introduced Nov 10 2022:

 ---
 https://github.com/WordPress/WordPress/commit/c9a4d274fcb6f176dfe1e509212780df6b749586
 ---

 I18N: Always pass $locale to load_textdomain().

 In [53874] the optional `$locale` parameter was added to
 `load_textdomain()`. While most `load_textdomain()` calls in core were
 were updated, some were missed. Passing the original locale avoids the
 need to call `determine_locale()` by `load_textdomain()` which is used as
 a fallback.

 Props ocean90, swissspidy, desrosj.
 See #57060.
 Built from https://develop.svn.wordpress.org/trunk@54797

 git-svn-id: http://core.svn.wordpress.org/trunk@54349 1a063a9b-
 81f0-0310-95a4-ce76da25c4cd

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58788>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list