Skip to content

Commit 4446004

Browse files
authored
Merge pull request #5708 from Cyperghost/bugfix/dateformfield
Error correction in DateFormField for invalid values
2 parents 829294c + 2b65ec3 commit 4446004

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

wcfsetup/install/files/lib/system/form/builder/field/DateFormField.class.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,17 @@ public function readValue()
291291
$this->getDocument()->hasRequestData($this->getPrefixedId())
292292
&& \is_string($this->getDocument()->getRequestData($this->getPrefixedId()))
293293
) {
294-
$this->value = $this->getDocument()->getRequestData($this->getPrefixedId());
294+
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
295+
$this->value = $value;
295296

296297
if ($this->value === '') {
297298
$this->value = null;
299+
} elseif ($this->getValueDateTimeObject() === null) {
300+
try {
301+
$this->value($value);
302+
} catch (\InvalidArgumentException) {
303+
$this->value = null;
304+
}
298305
}
299306
}
300307

0 commit comments

Comments
 (0)