Преглед изворни кода

Fix export (#5927)

Regression from https://github.com/FreshRSS/FreshRSS/pull/5830
Alexandre Alapetite пре 2 година
родитељ
комит
8bff77c45e
2 измењених фајлова са 15 додато и 0 уклоњено
  1. 13 0
      app/Models/DatabaseDAO.php
  2. 2 0
      app/Models/TagDAO.php

+ 13 - 0
app/Models/DatabaseDAO.php

@@ -407,4 +407,17 @@ SQL;
 			}
 		}
 	}
+
+	/**
+	 * Ensure that some PDO columns are `string` and not `bigint`.
+	 * @param array<string|int|null> $table
+	 * @param array<string> $columns
+	 */
+	public static function pdoString(array &$table, array $columns): void {
+		foreach ($columns as $column) {
+			if (isset($table[$column])) {
+				$table[$column] = (string)$table[$column];
+			}
+		}
+	}
 }

+ 2 - 0
app/Models/TagDAO.php

@@ -147,6 +147,8 @@ SQL;
 			return;
 		}
 		while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {
+			FreshRSS_DatabaseDAO::pdoInt($row, ['id_tag']);
+			FreshRSS_DatabaseDAO::pdoString($row, ['id_entry']);
 			yield $row;
 		}
 	}