aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Url.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-08-20 19:47:01 +0200
committerArthurHoaro <arthur@hoa.ro>2015-08-31 12:26:38 +0200
commit9e1724f1922bf9e38299eecedfce2dcdbd416749 (patch)
tree739a0d15a8225b75c9a0593f1c604774786fcf46 /application/Url.php
parentd7efade5d651ec60a05a86baa53f99188ad5d72c (diff)
downloadShaarli-9e1724f1922bf9e38299eecedfce2dcdbd416749.tar.gz
Shaarli-9e1724f1922bf9e38299eecedfce2dcdbd416749.tar.zst
Shaarli-9e1724f1922bf9e38299eecedfce2dcdbd416749.zip
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
Diffstat (limited to 'application/Url.php')
-rwxr-xr-x[-rw-r--r--]application/Url.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/application/Url.php b/application/Url.php
index 23356f39..02a4395d 100644..100755
--- a/application/Url.php
+++ b/application/Url.php
@@ -81,6 +81,10 @@ class Url
81 public function __construct($url) 81 public function __construct($url)
82 { 82 {
83 $this->parts = parse_url($url); 83 $this->parts = parse_url($url);
84
85 if (!empty($url) && empty($this->parts['scheme'])) {
86 $this->parts['scheme'] = 'http';
87 }
84 } 88 }
85 89
86 /** 90 /**
@@ -147,4 +151,16 @@ class Url
147 $this->cleanupFragment(); 151 $this->cleanupFragment();
148 return $this->__toString(); 152 return $this->__toString();
149 } 153 }
154
155 /**
156 * Get URL scheme.
157 *
158 * @return string the URL scheme or false if none is provided.
159 */
160 public function getScheme() {
161 if (!isset($this->parts['scheme'])) {
162 return false;
163 }
164 return $this->parts['scheme'];
165 }
150} 166}