Skip to content

Commit

Permalink
be sure to trim URL values
Browse files Browse the repository at this point in the history
  • Loading branch information
ziodave committed Sep 3, 2023
1 parent 58caea0 commit 0ca21dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/includes/class-wordlift-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ public static function sanitize_url( $value ) {
//
// see also http://stackoverflow.com/questions/2137080/php-filter-var-filter-validate-url

if ( $value !== null && '' !== $value ) {
return $value;
if ( ! is_string( $value ) ) {
return null;
}

$trimmed_value = trim( $value );
if ( '' !== $trimmed_value ) {
return $trimmed_value;
}

return null;
Expand Down

0 comments on commit 0ca21dd

Please sign in to comment.