From 9de98bd48a6838c6119247ad5c6ea06c64b56645 Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Tue, 31 May 2016 13:38:49 +1200 Subject: [PATCH] BUGFIX: is_array returning false negative for empty sets --- code/FileAttachmentField.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/FileAttachmentField.php b/code/FileAttachmentField.php index 60258da..5345908 100644 --- a/code/FileAttachmentField.php +++ b/code/FileAttachmentField.php @@ -210,8 +210,8 @@ public function saveInto(DataObjectInterface $record) { } } - if(($relation = $this->getRelation()) && is_array($this->Value())) { - $relation->setByIDList($this->Value()); + if(($relation = $this->getRelation())) { + $relation->setByIDList((array) $this->Value()); } elseif($record->has_one($fieldname)) { $record->{"{$fieldname}ID"} = $this->Value() ?: 0; } elseif($record->hasField($fieldname)) {