Skip to content

Commit

Permalink
refactor: strtolower() should take only string
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jan 6, 2022
1 parent 2778ce6 commit c49622f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion system/Validation/FormatRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ public function valid_url_strict(?string $str = null, ?string $validSchemes = nu
return false;
}

$scheme = strtolower(parse_url($str, PHP_URL_SCHEME) ?? ''); // absent scheme gives null
// parse_url() may return null and false
$scheme = strtolower((string) parse_url($str, PHP_URL_SCHEME));
$validSchemes = explode(
',',
strtolower($validSchemes ?? 'http,https')
Expand Down

0 comments on commit c49622f

Please sign in to comment.