From 1ccb934541c490a534027760ffb07da6027d4ddc Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 6 May 2017 12:25:27 +0200 Subject: [PATCH] Return false immediately if $url is empty for common_valid_http_url --- lib/util.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/util.php b/lib/util.php index a177c92a25..62db64d828 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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?$/'; -- 2.39.5