From 9e1724f1922bf9e38299eecedfce2dcdbd416749 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 20 Aug 2015 19:47:01 +0200 Subject: Fixes #325 - Shaarli does not recognize saved links PHP doesn't seem to autoconvert objects to strings when they're use as array indexes. Fixes regression introduced in d9d776af19fd0a191f82525991dafbb56e1bcfcb --- application/Url.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) mode change 100644 => 100755 application/Url.php (limited to 'application/Url.php') diff --git a/application/Url.php b/application/Url.php old mode 100644 new mode 100755 index 23356f39..02a4395d --- a/application/Url.php +++ b/application/Url.php @@ -81,6 +81,10 @@ class Url public function __construct($url) { $this->parts = parse_url($url); + + if (!empty($url) && empty($this->parts['scheme'])) { + $this->parts['scheme'] = 'http'; + } } /** @@ -147,4 +151,16 @@ class Url $this->cleanupFragment(); return $this->__toString(); } + + /** + * Get URL scheme. + * + * @return string the URL scheme or false if none is provided. + */ + public function getScheme() { + if (!isset($this->parts['scheme'])) { + return false; + } + return $this->parts['scheme']; + } } -- cgit v1.2.3