aboutsummaryrefslogtreecommitdiff
path: root/app/Models/DatabaseDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-11-18 23:21:20 +0100
committerGravatar GitHub <noreply@github.com> 2023-11-18 23:21:20 +0100
commitb65ea979010eb488cc9c1fb1d0f082e868c191d5 (patch)
treebe2c1b06aa5fcea8d33d43ba76acbfff3e4f0f0e /app/Models/DatabaseDAO.php
parent445e49db15ea7ae41dc55efea2d67903557f9182 (diff)
Fix PHP 7 compatibility strict_types (#5893)
* Fix PHP 7 compatibility https://github.com/FreshRSS/FreshRSS/discussions/5892 * Multiple PHP 7 fixes * PHPStan
Diffstat (limited to 'app/Models/DatabaseDAO.php')
-rw-r--r--app/Models/DatabaseDAO.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php
index 89327d6c9..05ca98355 100644
--- a/app/Models/DatabaseDAO.php
+++ b/app/Models/DatabaseDAO.php
@@ -393,4 +393,18 @@ SQL;
return true;
}
+
+ /**
+ * Ensure that some PDO columns are `int` and not `string`.
+ * Compatibility with PHP 7.
+ * @param array<string|int|null> $table
+ * @param array<string> $columns
+ */
+ public static function pdoInt(array &$table, array $columns): void {
+ foreach ($columns as $column) {
+ if (isset($table[$column]) && is_string($table[$column])) {
+ $table[$column] = (int)$table[$column];
+ }
+ }
+ }
}