Return false immediately if $url is empty for common_valid_http_url

This commit is contained in:
Mikael Nordfeldth 2017-05-06 12:25:27 +02:00
parent 434956fc75
commit 1ccb934541
1 changed files with 4 additions and 0 deletions

View File

@ -1885,6 +1885,10 @@ function common_log_objstring(&$object)
function common_valid_http_url($url, $secure=false)
{
if (empty($url)) {
return false;
}
// If $secure is true, only allow https URLs to pass
// (if false, we use '?' in 'https?' to say the 's' is optional)
$regex = $secure ? '/^https$/' : '/^https?$/';