Ticket #15936: 15936.5.diff
File 15936.5.diff, 4.6 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/network.php
135 135 136 136 $hostname = get_clean_basedomain(); 137 137 $has_ports = strstr( $hostname, ':' ); 138 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { 138 139 /** This filter is documented in wp-includes/ms-settings.php */ 140 $allowed_ports = apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ); 141 142 if ( ( false !== $has_ports && ! in_array( $has_ports, $allowed_ports ) ) ) { 139 143 echo '<div class="error"><p><strong>' . __( 'ERROR:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; 140 144 echo '<p>' . sprintf( 141 145 /* translators: %s: Port number. */ -
src/wp-includes/ms-settings.php
55 55 if ( ! isset( $current_site ) || ! isset( $current_blog ) ) { 56 56 57 57 $domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) ); 58 if ( substr( $domain, -3 ) == ':80' ) { 59 $domain = substr( $domain, 0, -3 ); 60 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 ); 61 } elseif ( substr( $domain, -4 ) == ':443' ) { 62 $domain = substr( $domain, 0, -4 ); 63 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); 58 59 /** 60 * Filters allowed HTTP ports in Multisite. 61 * 62 * @param array $allowed_ports The allowed ports. Default is [ ':80', ':443' ]. 63 * 64 * @since 5.3.0 65 * 66 */ 67 $allowed_ports = apply_filters( 'allowed_multisite_ports', array( ':80', ':443' ) ); 68 69 foreach ( $allowed_ports as $allowed_port ) { 70 $str_length = strlen( $allowed_port ); 71 if ( substr( $domain, - $str_length ) == $allowed_port ) { 72 $domain = substr( $domain, 0, - $str_length ); 73 $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, - $str_length ); 74 } 64 75 } 65 76 66 77 $path = stripslashes( $_SERVER['REQUEST_URI'] ); -
src/wp-includes/ms-site.php
534 534 // Sanitize domain if passed. 535 535 if ( array_key_exists( 'domain', $data ) ) { 536 536 $data['domain'] = trim( $data['domain'] ); 537 $data['domain'] = preg_replace( '|:\d+$|', '', $data['domain'] ); 537 538 $data['domain'] = preg_replace( '/\s+/', '', sanitize_user( $data['domain'], true ) ); 538 539 if ( is_subdomain_install() ) { 539 540 $data['domain'] = str_replace( '@', '', $data['domain'] ); -
tests/phpunit/tests/multisite/site.php
1385 1385 'lang_id' => 1, 1386 1386 ), 1387 1387 ), 1388 array( 1389 array( 1390 'domain' => 'example.com:443', 1391 ), 1392 array( 1393 'domain' => 'example.com', 1394 'path' => '/', 1395 ), 1396 ), 1397 array( 1398 array( 1399 'domain' => 'example.com:80', 1400 'path' => '/foo', 1401 ), 1402 array( 1403 'domain' => 'example.com', 1404 'path' => '/foo/', 1405 ), 1406 ), 1407 array( 1408 array( 1409 'domain' => '[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]', 1410 'path' => '/', 1411 ), 1412 array( 1413 'domain' => '[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]', 1414 'path' => '/', 1415 ), 1416 ), 1417 array( 1418 array( 1419 'domain' => '[3ffe:2a00:100:7031::1]:8080', 1420 'path' => '/', 1421 ), 1422 array( 1423 'domain' => '[3ffe:2a00:100:7031::1]:8080', 1424 'path' => '/', 1425 ), 1426 ), 1427 array( 1428 array( 1429 'domain' => 'wordpress.org:8080', 1430 'path' => '/', 1431 ), 1432 array( 1433 'domain' => 'wordpress.org:8080', 1434 'path' => '/', 1435 ), 1436 ), 1437 array( 1438 array( 1439 'domain' => '198.143.164.252', 1440 'path' => '/', 1441 ), 1442 array( 1443 'domain' => '198.143.164.252', 1444 'path' => '/', 1445 ), 1446 ), 1447 array( 1448 array( 1449 'domain' => '198.143.164.252:8080', 1450 'path' => '/', 1451 ), 1452 array( 1453 'domain' => '198.143.164.252:8080', 1454 'path' => '/', 1455 ), 1456 ), 1457 array( 1458 array( 1459 'domain' => '198.143.164.252:80', 1460 'path' => '/', 1461 ), 1462 array( 1463 'domain' => '198.143.164.252', 1464 'path' => '/', 1465 ), 1466 ), 1388 1467 ); 1389 1468 } 1390 1469