Skip to content

Commit

Permalink
Bootstrap/Load: Take the port number into consideration when determin…
Browse files Browse the repository at this point in the history
…ing whether a subdomain installation of Multisite is allowed.

This results in the prevention of an installation running on a port on localhost (for example `localhost:8889`) being converted to a subdomain Multisite installation, whereas previously it was incorrectly allowed.

Props spacedmonkey 

See #21077


git-svn-id: https://develop.svn.wordpress.org/trunk@58125 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
johnbillion committed May 9, 2024
1 parent 9c39283 commit 12dc165
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wp-admin/includes/network.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ function network_domain_check() {
* @return bool Whether subdomain installation is allowed
*/
function allow_subdomain_install() {
$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
$home = get_option( 'home' );
$domain = parse_url( $home, PHP_URL_HOST );
if ( parse_url( $home, PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
return false;
}

Expand Down

0 comments on commit 12dc165

Please sign in to comment.