From 1955249a6068221ab08353bb43781545ea7c0261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sat, 5 Apr 2025 00:53:01 +0200 Subject: [PATCH] Fix type handling in JSON decode for migration script Ensure `json_decode` explicitly casts database values to strings to avoid type errors during migration. This prevents potential issues when processing `options` fields that may not already be of string type. --- src/Bundle/ChillMainBundle/migrations/Version20250404123326.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/migrations/Version20250404123326.php b/src/Bundle/ChillMainBundle/migrations/Version20250404123326.php index 9eee4c74b..84330385e 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20250404123326.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20250404123326.php @@ -31,7 +31,7 @@ final class Version20250404123326 extends AbstractMigration $result = $this->connection->executeQuery('SELECT id, options FROM chill_main_saved_export'); foreach ($result->iterateAssociative() as $row) { - $options = json_decode($row['options'], true, 512, JSON_THROW_ON_ERROR); + $options = json_decode((string) $row['options'], true, 512, JSON_THROW_ON_ERROR); $this->addSql( 'UPDATE chill_main_saved_export SET options = :new_options WHERE id = :id', ['id' => $row['id'], 'new_options' => SavedExportOptionsMigrator::migrate($options)],