Make WordPress Core

Ticket #37991: fsockopen.php.2.patch

File fsockopen.php.2.patch, 571 bytes (added by amandato, 9 years ago)

Latest patch, written as a switch case statement which handles the situations more efficiently

Line 
1174,175c174,185
2<                       if ($url_parts['port'] !== 80) {
3<                               $out .= ':' . $url_parts['port'];
4---
5>                       switch( (!empty($url_parts['scheme'])? strtolower($url_parts['scheme']):'http') ) { // Default scheme to http if not specified
6>                               case 'https': {
7>                                       if( $url_parts['port'] !== 443 ) {
8>                                               $out .= ':' . $url_parts['port']; // Handle custom https scheme port
9>                                       }
10>                               }; break;
11>                               case 'http':
12>                               default: {
13>                                       if( $url_parts['port'] !== 80 ) {
14>                                               $out .= ':' . $url_parts['port']; // Handle custom port
15>                                       };
16>                               }