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 8a4bec811b
commit 709f1bbd75

View File

@ -1906,6 +1906,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?$/';