Skip to content
This repository
Browse code

BUGFIX Ensure that a single string value (as opposed to an array of

values) is accepted by implode() in CheckboxSetField by casting it
as an array.
  • Loading branch information...
commit 3f68e6f82f1283881e4b807383ff16b58ff57776 1 parent 86bdd16
Sean Harvey authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  forms/CheckboxSetField.php
4  forms/CheckboxSetField.php
@@ -179,7 +179,7 @@ function saveInto(DataObjectInterface $record) {
179 179
 		if($fieldname && $record && $relation && $relation instanceof RelationList) {
180 180
 			$idList = array();
181 181
 			if($this->value) foreach($this->value as $id => $bool) {
182  
-			   if($bool) {
  182
+				if($bool) {
183 183
 					$idList[] = $id;
184 184
 				}
185 185
 			}
@@ -187,7 +187,7 @@ function saveInto(DataObjectInterface $record) {
187 187
 		} elseif($fieldname && $record) {
188 188
 			if($this->value) {
189 189
 				$this->value = str_replace(',', '{comma}', $this->value);
190  
-				$record->$fieldname = implode(",", $this->value);
  190
+				$record->$fieldname = implode(',', (array) $this->value);
191 191
 			} else {
192 192
 				$record->$fieldname = '';
193 193
 			}

0 notes on commit 3f68e6f

Please sign in to comment.
Something went wrong with that request. Please try again.