Commit 1ccb9345 authored by mmn's avatar mmn

Return false immediately if $url is empty for common_valid_http_url

parent 434956fc
...@@ -1885,6 +1885,10 @@ function common_log_objstring(&$object) ...@@ -1885,6 +1885,10 @@ function common_log_objstring(&$object)
function common_valid_http_url($url, $secure=false) function common_valid_http_url($url, $secure=false)
{ {
if (empty($url)) {
return false;
}
// If $secure is true, only allow https URLs to pass // If $secure is true, only allow https URLs to pass
// (if false, we use '?' in 'https?' to say the 's' is optional) // (if false, we use '?' in 'https?' to say the 's' is optional)
$regex = $secure ? '/^https$/' : '/^https?$/'; $regex = $secure ? '/^https$/' : '/^https?$/';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment