Skip to content

Commit 274cbc4

Browse files
authored
Merge pull request #35163 from nextcloud/backport/35157/stable23
[stable23] Make sure to not pass null to DateTime::createFromFormat
2 parents f399ce4 + 7514a33 commit 274cbc4

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

apps/dav/lib/Files/FileSearchBackend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ private function castValue(SearchPropertyDefinition $property, $value) {
376376
if (is_numeric($value)) {
377377
return max(0, 0 + $value);
378378
}
379-
$date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, $value);
379+
$date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, (string)$value);
380380
return ($date instanceof \DateTime && $date->getTimestamp() !== false) ? $date->getTimestamp() : 0;
381381
default:
382382
return $value;

apps/files_external/lib/Lib/Storage/FTP.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function filemtime($path) {
123123
return $item['type'] === 'cdir';
124124
}));
125125
if ($currentDir) {
126-
$time = \DateTime::createFromFormat('YmdHis', $currentDir['modify']);
126+
$time = \DateTime::createFromFormat('YmdHis', $currentDir['modify'] ?? '');
127127
if ($time === false) {
128128
throw new \Exception("Invalid date format for directory: $currentDir");
129129
}
@@ -269,7 +269,7 @@ public function fopen($path, $mode) {
269269
case 'wb':
270270
case 'wb+':
271271
$useExisting = false;
272-
// no break
272+
// no break
273273
case 'a':
274274
case 'ab':
275275
case 'r+':

apps/sharebymail/lib/ShareByMailProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,6 @@ public function userDeletedFromGroup($uid, $gid) {
10991099
* @throws ShareNotFound
11001100
*/
11011101
protected function getRawShare($id) {
1102-
11031102
// Now fetch the inserted share and create a complete share object
11041103
$qb = $this->dbConnection->getQueryBuilder();
11051104
$qb->select('*')

apps/workflowengine/lib/Check/RequestTime.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ public function validateCheck($operator, $value) {
109109
}
110110

111111
$values = json_decode($value, true);
112-
$time1 = \DateTime::createFromFormat('H:i e', $values[0]);
112+
$time1 = \DateTime::createFromFormat('H:i e', (string)$values[0]);
113113
if ($time1 === false) {
114114
throw new \UnexpectedValueException($this->l->t('The given start time is invalid'), 3);
115115
}
116116

117-
$time2 = \DateTime::createFromFormat('H:i e', $values[1]);
117+
$time2 = \DateTime::createFromFormat('H:i e', (string)$values[1]);
118118
if ($time2 === false) {
119119
throw new \UnexpectedValueException($this->l->t('The given end time is invalid'), 4);
120120
}

0 commit comments

Comments
 (0)