You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you pass a URL whose redirect applies URL parameters, favicons will not fetch because of an incorrect application of self::baseUrl() in public function get().
Proof of concept
require_once('vendor/autoload.php');
$favicon = new \Favicon\Favicon();
var_dump($favicon->get('http://www.google.com'));
The only thing I'm not sure about is whether the added self::baseUrl() call should include the path or not 🤔 In my local test, it doesn't appear to make a difference whether I use
Description
If you pass a URL whose redirect applies URL parameters, favicons will not fetch because of an incorrect application of
self::baseUrl()
inpublic function get()
.Proof of concept
Expected output:
string(34) "https://www.google.com/favicon.ico"
Observed output:
bool(false)
Triage
Line 162 is the problem: https://github.com/ArthurHoaro/favicon/blob/master/src/Favicon/Favicon.php#L162 because the output of
$this->endRedirect(self::baseUrl($this->url, false))
for the given URLhttp://www.google.com
isstring(34) "https://www.google.com/?gws_rd=ssl"
This, in turn, means that
rtrim()
fails, because of the extra URL parameter.If we change L162 to
$url = rtrim(self::baseUrl($this->endRedirect(self::baseUrl($this->url, false)), false), '/');
, the favicon is fetched correctly.The text was updated successfully, but these errors were encountered: