From 84d96453fdabbdb22cad7182f980f8f718a847b7 Mon Sep 17 00:00:00 2001 From: andris-sevcenko Date: Thu, 11 Jul 2019 21:22:13 +0300 Subject: [PATCH] Fixed #4382 --- CHANGELOG-v3.md | 1 + src/fields/Assets.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG-v3.md b/CHANGELOG-v3.md index 4efc5b77819..dc9e6b7488b 100644 --- a/CHANGELOG-v3.md +++ b/CHANGELOG-v3.md @@ -17,6 +17,7 @@ - Fixed a bug where Assets fields set to restrict uploads to a single folder could have empty selector modals. ([#4522](https://github.com/craftcms/cms/issues/4522)) - Fixed an error that could occur if a template was accessing the deprecated `locale` property of an element query, but `siteId` wasn’t set to an integer. ([#4531](https://github.com/craftcms/cms/issues/4531)) - Fixed a bug where users without the “Publish live changes” permission for a section weren’t able to create new entries. ([#4528](https://github.com/craftcms/cms/issues/4529)) +- Fixed a PHP error that would occur when uploading a file to an Asset field using frontend. ([#4382](https://github.com/craftcms/cms/issues/4382)) ## 3.2.0 - 2019-07-09 diff --git a/src/fields/Assets.php b/src/fields/Assets.php index f132ce58b4d..225fe5d8414 100644 --- a/src/fields/Assets.php +++ b/src/fields/Assets.php @@ -578,6 +578,10 @@ private function _getUploadedFiles(ElementInterface $element): array /** @var Element $element */ $uploadedFiles = []; + if (ElementHelper::rootElement($element)->getIsRevision()) { + return $uploadedFiles; + } + // Grab data strings if (isset($this->_uploadedDataFiles['data']) && is_array($this->_uploadedDataFiles['data'])) { foreach ($this->_uploadedDataFiles['data'] as $index => $dataString) {