HTTP: Improve detection of valid IP addresses.
Merge of [37115] to the 4.0 branch. Built from https://develop.svn.wordpress.org/branches/4.0@37120 git-svn-id: http://core.svn.wordpress.org/branches/4.0@37087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
869f687c65
commit
84ad22efe9
|
@ -465,7 +465,7 @@ function wp_http_validate_url( $url ) {
|
|||
|
||||
if ( ! $same_host ) {
|
||||
$host = trim( $parsed_url['host'], '.' );
|
||||
if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) {
|
||||
if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) {
|
||||
$ip = $host;
|
||||
} else {
|
||||
$ip = gethostbyname( $host );
|
||||
|
|
Loading…
Reference in New Issue