Skip to content

Commit

Permalink
Don't include functions.php in wp_load_translations_early()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nacin committed Sep 4, 2012
1 parent 1635740 commit c97452d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions wp-admin/setup-config.php
Expand Up @@ -44,12 +44,14 @@
require(ABSPATH . WPINC . '/load.php'); require(ABSPATH . WPINC . '/load.php');
require(ABSPATH . WPINC . '/version.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. // Check for the required PHP version and for the MySQL extension or a database drop-in.
wp_check_php_mysql_versions(); 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. // Turn register_globals off.
wp_unregister_GLOBALS(); wp_unregister_GLOBALS();


Expand Down
5 changes: 2 additions & 3 deletions wp-includes/load.php
Expand Up @@ -105,12 +105,12 @@ function wp_check_php_mysql_versions() {
$php_version = phpversion(); $php_version = phpversion();
if ( version_compare( $required_php_version, $php_version, '>' ) ) { if ( version_compare( $required_php_version, $php_version, '>' ) ) {
wp_load_translations_early(); 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' ) ) { if ( ! extension_loaded( 'mysql' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
wp_load_translations_early(); 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.' ) );
} }
} }


Expand Down Expand Up @@ -709,7 +709,6 @@ function wp_load_translations_early() {
require_once ABSPATH . WPINC . '/locale.php'; require_once ABSPATH . WPINC . '/locale.php';


// General libraries // General libraries
require_once ABSPATH . WPINC . '/functions.php';
require_once ABSPATH . WPINC . '/plugin.php'; require_once ABSPATH . WPINC . '/plugin.php';


$locales = $locations = array(); $locales = $locations = array();
Expand Down
4 changes: 3 additions & 1 deletion wp-load.php
Expand Up @@ -48,8 +48,10 @@
require_once( ABSPATH . WPINC . '/load.php' ); require_once( ABSPATH . WPINC . '/load.php' );
require_once( ABSPATH . WPINC . '/version.php' ); require_once( ABSPATH . WPINC . '/version.php' );


wp_load_translations_early();
wp_check_php_mysql_versions(); wp_check_php_mysql_versions();
wp_load_translations_early();

require_once( ABSPATH . WPINC . '/functions.php' );


// Die with an error message // Die with an error message
$die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>'; $die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
Expand Down

0 comments on commit c97452d

Please sign in to comment.