HTTP: Improve detection of valid IP addresses.
Merge of [37115] to the 4.3 branch. Built from https://develop.svn.wordpress.org/branches/4.3@37117 git-svn-id: http://core.svn.wordpress.org/branches/4.3@37084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fdedd97120
commit
9046c96d95
|
@ -469,7 +469,7 @@ function wp_http_validate_url( $url ) {
|
||||||
|
|
||||||
if ( ! $same_host ) {
|
if ( ! $same_host ) {
|
||||||
$host = trim( $parsed_url['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;
|
$ip = $host;
|
||||||
} else {
|
} else {
|
||||||
$ip = gethostbyname( $host );
|
$ip = gethostbyname( $host );
|
||||||
|
|
Loading…
Reference in New Issue