A free, self-hostable news aggregator…
Compatibility PHP 8.2 for running automated tests (#5826)
Alexandre Alapetite85345559c7c6
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.phpindex d617fd672..eeb3e9843 100644--- a/app/Models/CategoryDAO.php+++ b/app/Models/CategoryDAO.php@@ -82,11 +82,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {return false;}- /** @param array<string> $errorInfo */+ /** @param array<string|int> $errorInfo */protected function autoUpdateDb(array $errorInfo): bool {if (isset($errorInfo[0])) {if ($errorInfo[0] === FreshRSS_DatabaseDAO::ER_BAD_FIELD_ERROR || $errorInfo[0] === FreshRSS_DatabaseDAOPGSQL::UNDEFINED_COLUMN) {- $errorLines = explode("\n", $errorInfo[2], 2); // The relevant column name is on the first line, other lines are noise+ $errorLines = explode("\n", (string)$errorInfo[2], 2); // The relevant column name is on the first line, other lines are noiseforeach (['kind', 'lastUpdate', 'error', 'attributes'] as $column) {if (stripos($errorLines[0], $column) !== false) {return $this->addColumn($column);diff --git a/app/Models/CategoryDAOSQLite.php b/app/Models/CategoryDAOSQLite.phpindex c076d25f1..ee6d5b7ad 100644--- a/app/Models/CategoryDAOSQLite.php+++ b/app/Models/CategoryDAOSQLite.php@@ -2,7 +2,7 @@class FreshRSS_CategoryDAOSQLite extends FreshRSS_CategoryDAO {- /** @param array<string> $errorInfo */+ /** @param array<int|string> $errorInfo */protected function autoUpdateDb(array $errorInfo): bool {if ($tableInfo = $this->pdo->query("PRAGMA table_info('category')")) {$columns = $tableInfo->fetchAll(PDO::FETCH_COLUMN, 1);diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.phpindex 82fb27903..017754e04 100644--- a/app/Models/EntryDAO.php+++ b/app/Models/EntryDAO.php@@ -65,11 +65,11 @@ SQL;}//TODO: Move the database auto-updates to DatabaseDAO- /** @param array<string> $errorInfo */+ /** @param array<string|int> $errorInfo */protected function autoUpdateDb(array $errorInfo): bool {if (isset($errorInfo[0])) {if ($errorInfo[0] === FreshRSS_DatabaseDAO::ER_BAD_FIELD_ERROR || $errorInfo[0] === FreshRSS_DatabaseDAOPGSQL::UNDEFINED_COLUMN) {- $errorLines = explode("\n", $errorInfo[2], 2); // The relevant column name is on the first line, other lines are noise+ $errorLines = explode("\n", (string)$errorInfo[2], 2); // The relevant column name is on the first line, other lines are noiseforeach (['attributes'] as $column) {if (stripos($errorLines[0], $column) !== false) {return $this->addColumn($column);@@ -78,8 +78,9 @@ SQL;}}if (isset($errorInfo[1])) {+ // May be a string or an intif ($errorInfo[1] == FreshRSS_DatabaseDAO::ER_DATA_TOO_LONG) {- if (stripos($errorInfo[2], 'content_bin') !== false) {+ if (stripos((string)$errorInfo[2], 'content_bin') !== false) {return $this->updateToMediumBlob(); //v1.15.0}}diff --git a/app/Models/EntryDAOPGSQL.php b/app/Models/EntryDAOPGSQL.phpindex 06a32712a..0e8ffa463 100644--- a/app/Models/EntryDAOPGSQL.php+++ b/app/Models/EntryDAOPGSQL.php@@ -18,11 +18,11 @@ class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite {return rtrim($sql, ' ;') . ' ON CONFLICT DO NOTHING';}- /** @param array<string> $errorInfo */+ /** @param array<string|int> $errorInfo */protected function autoUpdateDb(array $errorInfo): bool {if (isset($errorInfo[0])) {if ($errorInfo[0] === FreshRSS_DatabaseDAO::ER_BAD_FIELD_ERROR || $errorInfo[0] === FreshRSS_DatabaseDAOPGSQL::UNDEFINED_COLUMN) {- $errorLines = explode("\n", $errorInfo[2], 2); // The relevant column name is on the first line, other lines are noise+ $errorLines = explode("\n", (string)$errorInfo[2], 2); // The relevant column name is on the first line, other lines are noiseforeach (['attributes'] as $column) {if (stripos($errorLines[0], $column) !== false) {return $this->addColumn($column);diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.phpindex 956f4701a..136f6d550 100644--- a/app/Models/EntryDAOSQLite.php+++ b/app/Models/EntryDAOSQLite.php@@ -22,7 +22,7 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {return str_replace('INSERT INTO ', 'INSERT OR IGNORE INTO ', $sql);}- /** @param array<string> $errorInfo */+ /** @param array<string|int> $errorInfo */protected function autoUpdateDb(array $errorInfo): bool {if ($tableInfo = $this->pdo->query("PRAGMA table_info('entry')")) {$columns = $tableInfo->fetchAll(PDO::FETCH_COLUMN, 1) ?: [];diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.phpindex 474780981..ef9db1e01 100644--- a/app/Models/FeedDAO.php+++ b/app/Models/FeedDAO.php@@ -17,11 +17,11 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {return false;}- /** @param array<string> $errorInfo */+ /** @param array<int|string> $errorInfo */protected function autoUpdateDb(array $errorInfo): bool {if (isset($errorInfo[0])) {if ($errorInfo[0] === FreshRSS_DatabaseDAO::ER_BAD_FIELD_ERROR || $errorInfo[0] === FreshRSS_DatabaseDAOPGSQL::UNDEFINED_COLUMN) {- $errorLines = explode("\n", $errorInfo[2], 2); // The relevant column name is on the first line, other lines are noise+ $errorLines = explode("\n", (string)$errorInfo[2], 2); // The relevant column name is on the first line, other lines are noiseforeach (['kind'] as $column) {if (stripos($errorLines[0], $column) !== false) {return $this->addColumn($column);diff --git a/app/Models/FeedDAOSQLite.php b/app/Models/FeedDAOSQLite.phpindex 441a7d636..32d5bd0d2 100644--- a/app/Models/FeedDAOSQLite.php+++ b/app/Models/FeedDAOSQLite.php@@ -2,7 +2,7 @@class FreshRSS_FeedDAOSQLite extends FreshRSS_FeedDAO {- /** @param array<string> $errorInfo */+ /** @param array<int|string> $errorInfo */protected function autoUpdateDb(array $errorInfo): bool {if ($tableInfo = $this->pdo->query("PRAGMA table_info('feed')")) {$columns = $tableInfo->fetchAll(PDO::FETCH_COLUMN, 1);