summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edler <[email protected]>2021-11-30 21:50:09 +0100
committerChih-Hsuan Yen <[email protected]>2022-03-09 00:46:15 +0800
commitde1e218a835979a2b9b561cd6d5934cdc436dd67 (patch)
treef2659b0783b1398d17a6bc2d2a3b4da1f324ecca
parenta39557451604ba1ad4558f8283f1a13ca76ba5ba (diff)
various fixes vor php 8.1 compatibility
Cherry-picked from https://git-gitea.tt-rss.org/fox/tt-rss/pulls/56, while excluding changes in vendor/ (causes compatiblity issues with PHP<8 [1]) and strftime-related ones (already re-applied in https://git-gitea.tt-rss.org/fox/tt-rss/pulls/66). [1] https://community.tt-rss.org/t/support-for-php-8-1/5089/9
-rwxr-xr-xclasses/feeditem/atom.php2
-rw-r--r--classes/feedparser.php2
-rwxr-xr-xclasses/feeds.php2
-rw-r--r--classes/pref/system.php2
-rw-r--r--lib/jimIcon.php2
5 files changed, 5 insertions, 5 deletions
diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php
index 36a2e91f5..cac6d8c54 100755
--- a/classes/feeditem/atom.php
+++ b/classes/feeditem/atom.php
@@ -70,7 +70,7 @@ class FeedItem_Atom extends FeedItem_Common {
*
* @return string the rewritten XML or original $content
*/
- private function rewrite_content_to_base(?string $base = null, string $content) {
+ private function rewrite_content_to_base(?string $base = null, ?string $content = '') {
if (!empty($base) && !empty($content)) {
diff --git a/classes/feedparser.php b/classes/feedparser.php
index 3ed0647d2..fc2489e2d 100644
--- a/classes/feedparser.php
+++ b/classes/feedparser.php
@@ -200,7 +200,7 @@ class FeedParser {
// libxml may have invalid unicode data in error messages
function error() : string {
- return UConverter::transcode($this->error, 'UTF-8', 'UTF-8');
+ return UConverter::transcode($this->error ?? '', 'UTF-8', 'UTF-8');
}
/** @return array<string> - WARNING: may return invalid unicode data */
diff --git a/classes/feeds.php b/classes/feeds.php
index 6f812b98c..a06486883 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -23,7 +23,7 @@ class Feeds extends Handler_Protected {
*/
private function _format_headlines_list($feed, string $method, string $view_mode, int $limit, bool $cat_view,
int $offset, string $override_order, bool $include_children, ?int $check_first_id = null,
- bool $skip_first_id_check, string $order_by): array {
+ ?bool $skip_first_id_check = false, ? string $order_by = ''): array {
$disable_cache = false;
diff --git a/classes/pref/system.php b/classes/pref/system.php
index 10f196b55..806291c72 100644
--- a/classes/pref/system.php
+++ b/classes/pref/system.php
@@ -138,7 +138,7 @@ class Pref_System extends Handler_Administrative {
$sth->execute($errno_values);
while ($line = $sth->fetch()) {
- foreach ($line as $k => $v) { $line[$k] = htmlspecialchars($v); }
+ foreach ($line as $k => $v) { $line[$k] = htmlspecialchars($v ?? ''); }
?>
<tr>
<td class='errno'>
diff --git a/lib/jimIcon.php b/lib/jimIcon.php
index eaa768272..eb9a51458 100644
--- a/lib/jimIcon.php
+++ b/lib/jimIcon.php
@@ -31,7 +31,7 @@ class jimIcon {
}
if ($a != 127)
$this->all_transaprent = 0;
- return imagecolorallocatealpha($img, $r, $g, $b, $a);
+ return imagecolorallocatealpha($img, $r, $g, $b, (int) $a);
}
// Given a string with the contents of an .ICO,