Skip to content
Snippets Groups Projects
Commit 2888478d authored by dpi's avatar dpi
Browse files

Issue #3074723 by dpi, jibran: Better boundary check in getHelper

parent b49c6d38
Branches 3.2.x
No related tags found
No related merge requests found
......@@ -419,8 +419,12 @@ class DateRecurItem extends DateRangeItem {
return $this->helper;
}
$timeZoneString = $this->timezone;
if (empty($timeZoneString)) {
throw new DateRecurHelperArgumentException('Missing time zone');
}
try {
$timeZoneString = $this->timezone;
// If its not a string then cast it so a TypeError is not thrown. An empty
// string will cause the exception to be thrown.
$timeZone = new \DateTimeZone(is_string($timeZoneString) ? $timeZoneString : '');
......
......@@ -224,7 +224,7 @@ class DateRecurFieldItemTest extends KernelTestBase {
],
];
$this->expectException(DateRecurHelperArgumentException::class);
$this->expectExceptionMessage('Invalid time zone');
$this->expectExceptionMessage('Missing time zone');
$entity->dr[0]->getHelper();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment