Make WordPress Core

Ticket #2153: php_self_patch_for_wp-settings.diff

File php_self_patch_for_wp-settings.diff, 1.4 KB (added by abhay, 20 years ago)

patch using similar method as vars.php

  • trunk/wp-settings.php

     
    1818
    1919unregister_GLOBALS();
    2020
     21// On which page are we ?
     22$PHP_SELF = $_SERVER['PHP_SELF'];
     23if ( empty($PHP_SELF) )
     24        $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
     25
    2126$HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
    2227unset( $wp_filter, $cache_userdata, $cache_lastcommentmodified, $cache_lastpostdate, $cache_settings, $category_cache, $cache_categories );
    2328
     
    118123
    119124$wpdb->hide_errors();
    120125$db_check = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'");
    121 if ( !$db_check && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) ) {
    122         if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
     126if ( !$db_check && (!strstr($PHP_SELF, 'install.php') && !defined('WP_INSTALLING')) ) {
     127        if ( strstr($PHP_SELF, 'wp-admin') )
    123128                $link = 'install.php';
    124129        else
    125130                $link = 'wp-admin/install.php';
     
    142147require (ABSPATH . WPINC . '/kses.php');
    143148require (ABSPATH . WPINC . '/version.php');
    144149
    145 if (!strstr($_SERVER['PHP_SELF'], 'install.php')) :
     150if (!strstr($PHP_SELF, 'install.php')) :
    146151    // Used to guarantee unique hash cookies
    147152    $cookiehash = md5(get_settings('siteurl')); // Remove in 1.4
    148153        define('COOKIEHASH', $cookiehash);