From 2887dfffce571a631d3e678e33948e895d780b48 Mon Sep 17 00:00:00 2001 From: altheeagle Date: Sat, 1 Oct 2016 19:01:38 +0200 Subject: [PATCH] Updated Message.php The built-in filter_var constant "FILTER_VALIDATE_URL" doesn't work with "tel:" URIs as described in RFC 3966. This commit lets you use tel:-uris as an valid url to send with prowl --- src/Prowl/Message.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Prowl/Message.php b/src/Prowl/Message.php index d4f1ac2..a3e8712 100644 --- a/src/Prowl/Message.php +++ b/src/Prowl/Message.php @@ -88,9 +88,15 @@ class Message { * @return void */ public function setUrl($sUrl) { - $sUrl = filter_var($sUrl, FILTER_VALIDATE_URL); + $bVarRes = boolval(filter_var($sUrl, FILTER_VALIDATE_URL)); - if (!$sUrl) { + if (stripos($sUrl,'tel:') === 0 ) { + $bVarRes = true; + } else { + $bVarRes = false; + } + + if (!$bVarRes) { throw new \InvalidArgumentException("Given url [$sUrl] did not pass the validation."); }