Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#41092 closed defect (bug) (fixed)

PHP Fatal error: Uncaught Error: Call to undefined function get_bloginfo

Reported by: parsmizban Owned by: SergeyBiryukov
Milestone: 5.2 Priority: normal
Severity: critical Version: 4.8
Component: Bootstrap/Load Keywords: has-patch needs-testing
Focuses: rtl Cc:

Description (last modified by johnbillion)


I think there is a bug when Direction is RTL in themes,
I get many of these errors these days on our hosted wordpress web sites using PHP 7.1

Sample stack trace:

PHP Fatal error:  Uncaught Error: Call to undefined function get_bloginfo() in /home/username/public_html/wp-includes/class-wp-locale.php:233
Stack trace:
#0 /home/username/public_html/wp-includes/class-wp-locale.php(113): WP_Locale->init()
#1 /home/username/public_html/wp-includes/load.php(925): WP_Locale->__construct()
#2 /home/username/public_html/wp-includes/functions.php(1403): wp_load_translations_early()
#3 /home/username/public_html/wp-includes/load.php(538): is_blog_installed()
#4 /home/username/public_html/wp-settings.php(140): wp_not_installed()
#5 /home/username/public_html/wp-config.php(80): require_once('/home/username/...')
#6 /home/username/public_html/wp-load.php(37): require_once('/home/username/...')
#7 /home/username/public_html/wp-blog-header.php(13): require_once('/home/cryhhctz/...')
#8 /home/username/public_html/index.php(17): require('/home/username/...')
#9 {main}
  thrown in /home/username/public_html/wp-includes/class-wp-locale.php on line 233

Attachments (1)

41092 patch.patch (1010 bytes) - added by shazdeh 3 years ago.
Fix fatal error in WP when using RTL

Download all attachments as: .zip

Change History (10)

#1 @ateya3d
4 years ago

  • Severity changed from normal to critical


i face the same problem in my website

also rtl website

#2 @ateya3d
4 years ago

PHP Fatal error: Uncaught Error: Call to undefined function get_bloginfo() in /home/username/public_html/wp-includes/class-wp-locale.php:231
Stack trace:
#0 /home/username/public_html/wp-includes/class-wp-locale.php(112): WP_Locale->init()
#1 /home/username/public_html/wp-includes/load.php(927): WP_Locale->construct()
#2 /home/username/public_html/wp-includes/load.php(208): wp_load_translations_early()
#3 /home/username/public_html/wp-settings.php(63): wp_maintenance()
#4 /home/username/public_html/wp-config.php(110): require_once('/home/cgway/pub...')
#5 /home/username/public_html/wp-load.php(37): require_once('/home/cgway/pub...')
#6 /home/username/public_html/wp-blog-header.php(13): require_once('/home/cgway/pub...')
#7 /home/username/public_html/index.php(17): require('/home/cgway/pub...')
#8 {main}

thrown in /home/username/public_html/wp-includes/class-wp-locale.php on line 231

Version 0, edited 4 years ago by ateya3d (next)

3 years ago

Fix fatal error in WP when using RTL

#3 @shazdeh
3 years ago

  • Keywords has-patch added

#4 @johnbillion
3 years ago

  • Description modified (diff)

#5 @johnbillion
3 years ago

  • Component changed from General to Bootstrap/Load
  • Keywords needs-testing reporter-feedback added

Can somebody provide steps to reproduce this? What in the theme specifically triggers this error?

#6 @shazdeh
3 years ago

This happens in wp-includes/load.php::wp_check_php_mysql_versions() function. The function itself is called in wp-settings.php, before any of the general functions are loaded, so if there is an error (for example the "Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s." message) that needs to be translated, the function generates the fatal error instead of showing the actual error message as intended.

I think this can be replicated easily if you edit this line:

if ( version_compare( $required_php_version, $php_version, '>' ) ) {

And change the condition to true, simulating what would happen if those conditions were true.

#7 @SergeyBiryukov
3 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from Awaiting Review to 5.2

Reproduced with an RTL locale and the details from comment:6.

#8 @SergeyBiryukov
3 years ago

Introduced in [38459].

#9 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 45029:

Bootstrap/Load: Restore $wp_version global check in WP_Locale::init(), previously replaced with get_bloginfo( 'version' ) in [38459].

wp_load_translations_early() can be called in contexts where get_bloginfo() is not available yet, e.g. in wp_check_php_mysql_versions().

Props shazdeh, parsmizban.
Fixes #41092.

Note: See TracTickets for help on using tickets.