diff --git a/components/ILIAS/UI/src/Implementation/Component/Input/Group.php b/components/ILIAS/UI/src/Implementation/Component/Input/Group.php index cf0af1b206e7..ad13272feb76 100755 --- a/components/ILIAS/UI/src/Implementation/Component/Input/Group.php +++ b/components/ILIAS/UI/src/Implementation/Component/Input/Group.php @@ -142,6 +142,10 @@ protected function _isClientSideValueOk($value): bool if (!array_key_exists($key, $value)) { return false; } + /** this is currently entangled to {@see Input::withValue()} */ + if (null === $value[$key]) { + continue; + } if (!$input->isClientSideValueOk($value[$key])) { return false; } diff --git a/components/ILIAS/UI/tests/Component/Input/Field/GroupInputTest.php b/components/ILIAS/UI/tests/Component/Input/Field/GroupInputTest.php index 4e88da38b374..eb2902df69bf 100755 --- a/components/ILIAS/UI/tests/Component/Input/Field/GroupInputTest.php +++ b/components/ILIAS/UI/tests/Component/Input/Field/GroupInputTest.php @@ -171,6 +171,35 @@ public function testGroupForwardsValuesOnWithValue(): void $this->assertNotSame($this->group, $new_group); } + public function testGroupForwardsNullWithoutValidationOnWithValue(): void + { + $this->child1 + ->expects($this->once()) + ->method("withValue") + ->with(1) + ->willReturn($this->child2); + $this->child1 + ->expects($this->once()) + ->method("isClientSideValueOk") + ->with(1) + ->willReturn(true); + $this->child2 + ->expects($this->once()) + ->method("withValue") + ->with(null) + ->willReturn($this->child1); + $this->child2 + ->expects($this->never()) + ->method("isClientSideValueOk") + ->with(null) + ->willReturn(true); + + $new_group = $this->group->withValue([1, null]); + + $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs()); + $this->assertNotSame($this->group, $new_group); + } + public function testWithValuePreservesKeys(): void { $this->assertNotSame($this->child1, $this->child2);