aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-11-07 13:15:48 +0100
committerGravatar GitHub <noreply@github.com> 2023-11-07 13:15:48 +0100
commit85345559c7c66787ad9474da8a63de24e6484843 (patch)
tree3a19f00d18fc8f12ce3551413af62ec0ec98834d /app/Models
parent711e2153d11f3df181be2f6248368d75a36b5725 (diff)
Compatibility PHP 8.2 for running automated tests (#5826)
https://php.net/pdo.errorinfo has slightly changed signature
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/CategoryDAO.php4
-rw-r--r--app/Models/CategoryDAOSQLite.php2
-rw-r--r--app/Models/EntryDAO.php7
-rw-r--r--app/Models/EntryDAOPGSQL.php4
-rw-r--r--app/Models/EntryDAOSQLite.php2
-rw-r--r--app/Models/FeedDAO.php4
-rw-r--r--app/Models/FeedDAOSQLite.php2
7 files changed, 13 insertions, 12 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index 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 noise
foreach (['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.php
index 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.php
index 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 noise
foreach (['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 int
if ($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.php
index 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 noise
foreach (['attributes'] as $column) {
if (stripos($errorLines[0], $column) !== false) {
return $this->addColumn($column);
diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php
index 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.php
index 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 noise
foreach (['kind'] as $column) {
if (stripos($errorLines[0], $column) !== false) {
return $this->addColumn($column);
diff --git a/app/Models/FeedDAOSQLite.php b/app/Models/FeedDAOSQLite.php
index 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);