Commit 901ae985 authored by webchick's avatar webchick

Issue #2082983 by Xano: \Drupal\Core\TypedData\List accepts non-list values.

parent ac9ab3b8
......@@ -56,7 +56,7 @@ public function getValue() {
*/
public function setValue($values, $notify = TRUE) {
if (!isset($values) || $values === array()) {
$this->list = $values;
$this->list = array();
}
else {
if (!is_array($values)) {
......
......@@ -352,11 +352,10 @@ public function testTypedDataLists() {
$clone->setValue(array());
$this->assertTrue($clone->isEmpty());
// Make sure the difference between NULL (not set) and an empty array is
// kept.
// Make sure that resetting the value using NULL results in an empty array.
$clone->setValue(array());
$typed_data->setValue(NULL);
$this->assertNull($typed_data->getValue());
$this->assertIdentical($typed_data->getValue(), array());
$this->assertIdentical($clone->getValue(), array());
// Test dealing with NULL items.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment