Skip to content

Commit 770444c

Browse files
MrRocojenswittmann
authored andcommitted
Fix saving resources when Date TV has no input properties (modxcms#16652)
### What does it do? Check if tvProperties is an array ### Why is it needed? Issue: BUG-16651 ### How to test Create a new Date TV without any input properties and test if you can save a paege. ### Related issue(s)/PR(s) BUG-16651
1 parent eef3042 commit 770444c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

core/src/Revolution/Processors/Resource/Create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ public function addTemplateVariables()
510510
$tvProperties = $tv->get('input_properties');
511511
if (!empty($value)) {
512512
$dateTime = new \DateTime($value);
513-
if (array_key_exists('hideTime', $tvProperties) && (bool)$tvProperties['hideTime'] && $tvProperties['hideTime'] != 'false') {
513+
if (is_array($tvProperties) && array_key_exists('hideTime', $tvProperties) && (bool)$tvProperties['hideTime'] && $tvProperties['hideTime'] != 'false') {
514514
$dateTime->setTime(0, 0, 0, 0);
515515
}
516516
$value = $dateTime->format('Y-m-d H:i:s');

core/src/Revolution/Processors/Resource/Update.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ public function saveTemplateVariables()
748748
$tvProperties = $tv->get('input_properties');
749749
if (!empty($value)) {
750750
$dateTime = new \DateTime($value);
751-
if (array_key_exists('hideTime', $tvProperties) && (bool)$tvProperties['hideTime'] && $tvProperties['hideTime'] != 'false') {
751+
if (is_array($tvProperties) && array_key_exists('hideTime', $tvProperties) && (bool)$tvProperties['hideTime'] && $tvProperties['hideTime'] != 'false') {
752752
$dateTime->setTime(0, 0, 0, 0);
753753
}
754754
$value = $dateTime->format('Y-m-d H:i:s');

0 commit comments

Comments
 (0)