Make WordPress Core


Ignore:
Timestamp:
09/04/2012 02:46:01 AM (13 years ago)
Author:
nacin
Message:

setup-config.php must be parseable by PHP4 so we can show a sane error message. wp-admin/index.php should ideally be as well. props SergeyBiryukov, see #21316.

File:
1 edited

Legend:

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

    r21715 r21716  
    220220
    221221    $key = 0;
    222     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 ) {
    223224        if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
    224             $line = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
     225            $config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
    225226            continue;
    226227        }
     
    237238            case 'DB_PASSWORD' :
    238239            case 'DB_HOST'     :
    239                 $line = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
     240                $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
    240241                break;
    241242            case 'AUTH_KEY'         :
     
    247248            case 'LOGGED_IN_SALT'   :
    248249            case 'NONCE_SALT'       :
    249                 $line = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
     250                $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
    250251                break;
    251252        }
Note: See TracChangeset for help on using the changeset viewer.