From c97452d95527d4fce4e695094c5d0ede13ea6538 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 4 Sep 2012 02:38:37 +0000 Subject: [PATCH] Don't include functions.php in wp_load_translations_early() to avoid a parse error in a PHP4 environment (caused by use of the clone keyword in option.php). Manually include functions.php in the rare situations where it is not already included by the time we need to load translations early. Remove the functions.php dependency by switching the wp_die() calls to die(), in wp_check_php_mysql_versions(). props SergeyBiryukov, see #21316, for trunk. git-svn-id: http://core.svn.wordpress.org/trunk@21715 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/setup-config.php | 8 +++++--- wp-includes/load.php | 5 ++--- wp-load.php | 4 +++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 6201b00451..89998b8c29 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -44,12 +44,14 @@ define('WP_DEBUG', false); require(ABSPATH . WPINC . '/load.php'); require(ABSPATH . WPINC . '/version.php'); -// Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php) -wp_load_translations_early(); - // Check for the required PHP version and for the MySQL extension or a database drop-in. wp_check_php_mysql_versions(); +require_once(ABSPATH . WPINC . '/functions.php'); + +// Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php) +wp_load_translations_early(); + // Turn register_globals off. wp_unregister_GLOBALS(); diff --git a/wp-includes/load.php b/wp-includes/load.php index 488f420dd4..7ad0341fb0 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -105,12 +105,12 @@ function wp_check_php_mysql_versions() { $php_version = phpversion(); if ( version_compare( $required_php_version, $php_version, '>' ) ) { wp_load_translations_early(); - wp_die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) ); + die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) ); } if ( ! extension_loaded( 'mysql' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) { wp_load_translations_early(); - wp_die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) ); + die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) ); } } @@ -709,7 +709,6 @@ function wp_load_translations_early() { require_once ABSPATH . WPINC . '/locale.php'; // General libraries - require_once ABSPATH . WPINC . '/functions.php'; require_once ABSPATH . WPINC . '/plugin.php'; $locales = $locations = array(); diff --git a/wp-load.php b/wp-load.php index 600805a2d1..1372688f3a 100644 --- a/wp-load.php +++ b/wp-load.php @@ -48,8 +48,10 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) { require_once( ABSPATH . WPINC . '/load.php' ); require_once( ABSPATH . WPINC . '/version.php' ); - wp_load_translations_early(); wp_check_php_mysql_versions(); + wp_load_translations_early(); + + require_once( ABSPATH . WPINC . '/functions.php' ); // Die with an error message $die = __( "There doesn't seem to be a wp-config.php file. I need this before we can get started." ) . '

';