diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 63956bc90d..03578b4ddc 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -857,7 +857,7 @@ class Migrations extends Action } /** - * Sanitize migration errors, removing sensitive information like stack traces + * Encode migration errors as JSON strings for storage on the migration document. * * @param array $sourceErrors * @param array $destinationErrors @@ -867,20 +867,10 @@ class Migrations extends Action array $sourceErrors, array $destinationErrors, ): array { - $errors = []; - foreach ([...$sourceErrors, ...$destinationErrors] as $error) { - $encoded = \json_decode(\json_encode($error), true); - if (\is_array($encoded)) { - if (isset($encoded['trace'])) { - unset($encoded['trace']); - } - $errors[] = \json_encode($encoded); - } else { - $errors[] = \json_encode($error); - } - } - - return $errors; + return \array_map( + fn ($error) => \json_encode($error), + [...$sourceErrors, ...$destinationErrors], + ); } private function processMigrationResourceStats(array $resources, Context $usage, Document $projectDocument, UsagePublisher $publisherForUsage, string $source, Authorization $authorization, ?string $resourceId)