diff --git a/packages/plugin/src/Bundles/Fields/Implementations/FileUpload/FileRemovalOnSubmissionDelete.php b/packages/plugin/src/Bundles/Fields/Implementations/FileUpload/FileRemovalOnSubmissionDelete.php index fa4c4d7d7..df273f78e 100644 --- a/packages/plugin/src/Bundles/Fields/Implementations/FileUpload/FileRemovalOnSubmissionDelete.php +++ b/packages/plugin/src/Bundles/Fields/Implementations/FileUpload/FileRemovalOnSubmissionDelete.php @@ -29,7 +29,9 @@ public function removeSubmissionFiles(Event $event): void if (\is_array($value)) { foreach ($value as $id) { - \Craft::$app->elements->deleteElementById($id); + if (\is_int($id)) { + \Craft::$app->elements->deleteElementById($id); + } } } } diff --git a/packages/plugin/src/Services/SubmissionsService.php b/packages/plugin/src/Services/SubmissionsService.php index 73ad9e9db..32dcdbd67 100644 --- a/packages/plugin/src/Services/SubmissionsService.php +++ b/packages/plugin/src/Services/SubmissionsService.php @@ -408,11 +408,13 @@ public function purgeSubmissions(?int $age = null): array $assetIds = array_unique($assetIds); foreach ($assetIds as $assetId) { - \Craft::$app->elements->deleteElementById( - $assetId, - hardDelete: true, - ); - ++$deletedAssets; + if (\is_int($assetId)) { + \Craft::$app->elements->deleteElementById( + $assetId, + hardDelete: true, + ); + ++$deletedAssets; + } } }