Skip to content

Commit 60e1f79

Browse files
committed
Fix
1 parent 1896235 commit 60e1f79

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

tests/bootstrap.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,18 @@ function wp_strip_all_tags( string $value, bool $remove_breaks = false ): string
301301
* @param array<int, string>|null $protocols Allowed protocols.
302302
* @return string Sanitized URL.
303303
*/
304-
function esc_url_raw( string $url, ?array $protocols = null ): string {
305-
$url = trim( $url );
306-
$scheme = parse_url( $url, PHP_URL_SCHEME );
307-
$allowed_protocols = $protocols ?? array();
304+
function esc_url_raw( string $url, ?array $protocols = null ): string {
305+
$url = trim( $url );
306+
$scheme = parse_url( $url, PHP_URL_SCHEME );
307+
$allowed_protocols = $protocols ?? array();
308308

309-
if ( ! empty( $allowed_protocols ) && is_string( $scheme ) && ! in_array( $scheme, $allowed_protocols, true ) ) {
310-
return '';
311-
}
309+
if ( false === $scheme ) {
310+
return '';
311+
}
312+
313+
if ( ! empty( $allowed_protocols ) && is_string( $scheme ) && ! in_array( $scheme, $allowed_protocols, true ) ) {
314+
return '';
315+
}
312316

313317
return filter_var( $url, FILTER_VALIDATE_URL ) ? $url : '';
314318
}

0 commit comments

Comments
 (0)