+
+ // T212067: PHP < 5.6.28, 7.0.0–7.0.12, and HHVM (all relevant versions) screw up parsing
+ // the query part of pathless URLs
+ if ( isset( $bits['host'] ) && strpos( $bits['host'], '?' ) !== false ) {
+ list( $host, $query ) = explode( '?', $bits['host'], 2 );
+ $bits['host'] = $host;
+ $bits['query'] = $query
+ . ( $bits['path'] ?? '' )
+ . ( isset( $bits['query'] ) ? '?' . $bits['query'] : '' );
+ unset( $bits['path'] );
+ }
+