Return false immediately if $url is empty for common_valid_http_url
This commit is contained in:
parent
8a4bec811b
commit
709f1bbd75
@ -1906,6 +1906,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?$/';
|
||||||
|
Loading…
Reference in New Issue
Block a user