WordPress.org

Make WordPress Core

Opened 21 months ago

Last modified 7 months ago

#41092 new defect (bug)

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

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

Description (last modified by johnbillion)

Hi,

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 7 months ago.
Fix fatal error in WP when using RTL

Download all attachments as: .zip

Change History (7)

#1 @ateya3d
12 months ago

  • Severity changed from normal to critical

Hello

i face the same problem in my website

also rtl website

#2 @ateya3d
12 months 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
Last edited 7 months ago by johnbillion (previous) (diff)

@shazdeh
7 months ago

Fix fatal error in WP when using RTL

#3 @shazdeh
7 months ago

  • Keywords has-patch added

#4 @johnbillion
7 months ago

  • Description modified (diff)

#5 @johnbillion
7 months 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
7 months 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.

Note: See TracTickets for help on using tickets.