Return false immediately if $url is empty for common_valid_http_url
This commit is contained in:
parent
434956fc75
commit
1ccb934541
|
@ -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?$/';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user