Permalink
Browse files

Fix php fatal error

When SimplePie_IRI::absolutize is fed with a broken URL (for example
'http://https://www.couchsurfing.org/'), it returns bool(false)

But SimplePie_Misc::absolutize_url do not check this and
unconditionally call get_uri(), leading to a fatal error:
"PHP Fatal error:  Call to a member function get_uri() on a non-object in
/home/www/common/simplepie/library/SimplePie/Misc.php on line 83"
  • Loading branch information...
casta committed Aug 23, 2012
1 parent 09288e5 commit 7c3b32a90d07d1723638661d2156acf3ab41b4a6
Showing with 8 additions and 1 deletion.
  1. +8 −1 library/SimplePie/Misc.php
@@ -80,7 +80,14 @@ public static function time_hms($seconds)
public static function absolutize_url($relative, $base)
{
$iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
- return $iri->get_uri();
+ if ($iri !== false)
+ {
+ return $iri->get_uri();
+ }
+ else
+ {
+ return $relative;
+ }
}
/**

0 comments on commit 7c3b32a

Please sign in to comment.