WordPress.org

Make WordPress Core

Ticket #4732: guessurl.patch

File guessurl.patch, 1.5 KB (added by hansengel, 10 years ago)

Patch to fix $guessurl

  • wp-admin/includes/schema.php

     
    149149        global $wpdb, $wp_db_version;
    150150
    151151        $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
    152         $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     152        $guessurl = eregi($schema . $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']) ? preg_replace('|/wp-admin/.*|i', '', $_SERVER['REQUEST_URI']) : preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    153153        add_option('siteurl', $guessurl);
    154154        add_option('blogname', __('My Blog'));
    155155        add_option('blogdescription', __('Just another WordPress weblog'));
  • wp-admin/includes/upgrade.php

     
    2323        if ( defined('WP_SITEURL') && '' != WP_SITEURL )
    2424                $guessurl = WP_SITEURL;
    2525        else
    26                 $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     26                $guessurl = eregi($schema . $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']) ? preg_replace('|/wp-admin/.*|i', '', $_SERVER['REQUEST_URI']) : preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    2727
    2828        update_option('siteurl', $guessurl);
    2929