aboutsummaryrefslogtreecommitdiff
path: root/lib/favicons.php
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2023-07-07 21:53:17 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-07 21:53:17 +0200
commit7f9594b8c7d7799f2e5f89328bd5981410db8cf0 (patch)
tree67614f8f3d04e94139d19dad3dd438f3bd949368 /lib/favicons.php
parent1db606bc1b6cf25d9b9c4bef362acdb964ce1e8a (diff)
fix many "Only booleans are allowed in an if condition" (#5501)
* fix many "Only booleans are allowed in an if condition" * Update cli/create-user.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> * Update cli/i18n/I18nUsageValidator.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> * Fix several regressions and other minor things * Fix another regression * Update lib/http-conditional.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> --------- Co-authored-by: Luc <sanchezluc+freshrss@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'lib/favicons.php')
-rw-r--r--lib/favicons.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/favicons.php b/lib/favicons.php
index b5c70d975..8da38c519 100644
--- a/lib/favicons.php
+++ b/lib/favicons.php
@@ -78,13 +78,14 @@ function searchFavicon(string &$url): string {
$href = trim($link->getAttribute('href'));
if (substr($href, 0, 2) === '//') {
// Case of protocol-relative URLs
- if (preg_match('%^(https?:)//%i', $url, $matches)) {
+ if (preg_match('%^(https?:)//%i', $url, $matches) === 1) {
$href = $matches[1] . $href;
} else {
$href = 'https:' . $href;
}
}
- if (!checkUrl($href, false)) {
+ $checkUrl = checkUrl($href, false);
+ if (is_string($checkUrl)) {
$href = SimplePie_IRI::absolutize($url, $href);
}
$favicon = downloadHttp($href, array(
@@ -119,6 +120,6 @@ function download_favicon(string $url, string $dest): bool {
}
}
}
- return ($favicon != '' && file_put_contents($dest, $favicon)) ||
+ return ($favicon != '' && file_put_contents($dest, $favicon) > 0) ||
@copy(DEFAULT_FAVICON, $dest);
}