Make WordPress Core


Ignore:
Timestamp:
09/04/2012 08:31:14 PM (13 years ago)
Author:
nacin
Message:

Ensure we are parseable by PHP4 until wp_check_php_mysql_versions() has a chance to run.

Merges [21715], [21716] to the 3.4 branch.
props SergeyBiryukov.
fixes #21316.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.4/wp-admin/setup-config.php

    r20661 r21739  
    4545require(ABSPATH . WPINC . '/version.php');
    4646
    47 // Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
    48 wp_load_translations_early();
    49 
    5047// Check for the required PHP version and for the MySQL extension or a database drop-in.
    5148wp_check_php_mysql_versions();
     49
     50require_once(ABSPATH . WPINC . '/functions.php');
     51
     52// Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
     53wp_load_translations_early();
    5254
    5355// Turn register_globals off.
     
    218220
    219221    $key = 0;
    220     foreach ( $config_file as &$line ) {
     222    // Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
     223    foreach ( $config_file as $line_num => $line ) {
    221224        if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
    222             $line = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
     225            $config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
    223226            continue;
    224227        }
     
    235238            case 'DB_PASSWORD' :
    236239            case 'DB_HOST'     :
    237                 $line = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
     240                $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
    238241                break;
    239242            case 'AUTH_KEY'         :
     
    245248            case 'LOGGED_IN_SALT'   :
    246249            case 'NONCE_SALT'       :
    247                 $line = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
     250                $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
    248251                break;
    249252        }
Note: See TracChangeset for help on using the changeset viewer.