[wp-trac] [WordPress Trac] #14867: HTTPS related issues in ms-blogs.php (with fix)

WordPress Trac noreply at wordpress.org
Thu May 22 13:30:14 UTC 2014


#14867: HTTPS related issues in ms-blogs.php (with fix)
--------------------------+-----------------------------
 Reporter:  mareck        |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  Future Release
Component:  Permalinks    |     Version:
 Severity:  normal        |  Resolution:  worksforme
 Keywords:  has-patch     |     Focuses:  multisite
--------------------------+-----------------------------
Changes (by hopetommola):

 * status:  reopened => closed
 * resolution:   => worksforme


Comment:

 I'm no pro, but here's the update from my perspective ... I reviewed the
 diff provided by adambackstrom, 3 years ago and compared it to the current
 version of ms-blogs.php in WP 3.9.1 beginning on line 38.

 The section of Adam's diff which begins on line 51 of the current version
 has changed quite a bit, no longer including explicit `http://` so I
 disregarded this piece.

 I changed the following:

 {{{
 function get_blogaddress_by_id( $blog_id ) {
         $bloginfo = get_blog_details( (int) $blog_id, false ); // only get
 bare details!
         return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path );
 }
 }}}

 to this, in accordance with Adam's diff, but taking into consideration the
 comments about using $scheme instead of $protocol ...


 {{{
 function get_blogaddress_by_id( $blog_id, $scheme = null ) {
         if ( ! in_array( $scheme, array( 'http', 'https' ) ) )
         $scheme = is_ssl() ? 'https' : 'http';

         $bloginfo = get_blog_details( (int) $blog_id, false ); // only get
 bare details!
         return esc_url( "$scheme://" . $bloginfo->domain . $bloginfo->path
 );
 }
 }}}

 I then created a new subsite, which correctly assumed the https scheme in
 both the home and siteurl addresses, as well as all newly uploaded media.

 I read the later comments about it "polluting" the home and siteurl
 addresses upon creation and, like others above, don't know what that means
 ... it performed exactly as I had desired and expected, and the home and
 siteurl are correct.

 I don't know if this means it's a "fix" or "patch" or whathaveyou - as I
 said, I'm not exactly a php programmer, much more like a critical
 deconstructionist ... so, I hope this gets added to the new release of WP
 so I won't have to modify ms-blogs.php in every update. Also hope this
 works for everyone else, because I don't know about you, but I certainly
 burned up a lot of time trying to get to the bottom of this.

 Cheers
 CT

--
Ticket URL: <https://core.trac.wordpress.org/ticket/14867#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list