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 d9d776af19
This commit is contained in:
parent
d7efade5d6
commit
9e1724f192
3 changed files with 73 additions and 35 deletions
application
16
application/Url.php
Normal file → Executable file
16
application/Url.php
Normal file → Executable file
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue