Skip to content

Commit d0a17f6

Browse files
committed
Confirm host is a non empty property
1 parent a7f8b9c commit d0a17f6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

includes/class-hcard-user.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,13 @@ public static function clean_url( $string ) {
254254
if ( ! filter_var( $url, FILTER_VALIDATE_URL ) ) {
255255
return false;
256256
}
257+
$host = wp_parse_url( $url, PHP_URL_HOST );
258+
if ( ! $host ) {
259+
return false;
260+
}
257261
// Rewrite these to https as needed
258262
$secure = apply_filters( 'iwc_rewrite_secure', array( 'facebook.com', 'twitter.com', 'github.com' ) );
259-
if ( in_array( preg_replace( '/^www\./', '', wp_parse_url( $url, PHP_URL_HOST ) ), $secure, true ) ) {
263+
if ( in_array( preg_replace( '/^www\./', '', $host ), $secure, true ) ) {
260264
$url = preg_replace( '/^http:/i', 'https:', $url );
261265
}
262266
$url = esc_url_raw( $url );

0 commit comments

Comments
 (0)