From b65ea979010eb488cc9c1fb1d0f082e868c191d5 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 18 Nov 2023 23:21:20 +0100 Subject: Fix PHP 7 compatibility strict_types (#5893) * Fix PHP 7 compatibility https://github.com/FreshRSS/FreshRSS/discussions/5892 * Multiple PHP 7 fixes * PHPStan --- app/Models/DatabaseDAO.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/Models/DatabaseDAO.php') 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 $table + * @param array $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]; + } + } + } } -- cgit v1.2.3