diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2022-11-22 10:09:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 10:09:35 +0100 |
commit | daba1122473fd07cba928526784024b61343eb94 (patch) | |
tree | cc86185085914fd5492eb8fa2ff6c129933cbdc9 | |
parent | a5961d1977285e4b1eb0a04eb50f7d9898560476 (diff) | |
parent | 058bf13482fd246282408388e1f8a893fdbfd692 (diff) | |
download | nextcloud-server-daba1122473fd07cba928526784024b61343eb94.tar.gz nextcloud-server-daba1122473fd07cba928526784024b61343eb94.zip |
Merge pull request #35161 from nextcloud/backport/35157/stable25
[stable25] Make sure to not pass null to DateTime::createFromFormat
-rw-r--r-- | apps/dav/lib/Files/FileSearchBackend.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/FTP.php | 4 | ||||
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 5 | ||||
-rw-r--r-- | apps/workflowengine/lib/Check/RequestTime.php | 4 |
4 files changed, 8 insertions, 9 deletions
diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index c819fa6afc6..524f90e6623 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -55,7 +55,7 @@ use SearchDAV\Query\Order; use SearchDAV\Query\Query; class FileSearchBackend implements ISearchBackend { - const OPERATOR_LIMIT = 100; + public const OPERATOR_LIMIT = 100; /** @var CachingTree */ private $tree; @@ -432,7 +432,7 @@ class FileSearchBackend implements ISearchBackend { if (is_numeric($value)) { return max(0, 0 + $value); } - $date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, $value); + $date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, (string)$value); return ($date instanceof \DateTime && $date->getTimestamp() !== false) ? $date->getTimestamp() : 0; default: return $value; diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index d424ffe3cdd..998d147b7c7 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -123,7 +123,7 @@ class FTP extends Common { return $item['type'] === 'cdir'; })); if ($currentDir) { - $time = \DateTime::createFromFormat('YmdHis', $currentDir['modify']); + $time = \DateTime::createFromFormat('YmdHis', $currentDir['modify'] ?? ''); if ($time === false) { throw new \Exception("Invalid date format for directory: $currentDir"); } @@ -269,7 +269,7 @@ class FTP extends Common { case 'wb': case 'wb+': $useExisting = false; - // no break + // no break case 'a': case 'ab': case 'r+': diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 01dd3b428d1..af3d14b49bc 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -1042,8 +1042,8 @@ class ShareByMailProvider implements IShareProvider { $share->setShareTime($shareTime); $share->setSharedWith($data['share_with']); $share->setPassword($data['password']); - $passwordExpirationTime = \DateTime::createFromFormat('Y-m-d H:i:s', $data['password_expiration_time']); - $share->setPasswordExpirationTime($passwordExpirationTime !== false? $passwordExpirationTime : null); + $passwordExpirationTime = \DateTime::createFromFormat('Y-m-d H:i:s', $data['password_expiration_time'] ?? ''); + $share->setPasswordExpirationTime($passwordExpirationTime !== false ? $passwordExpirationTime : null); $share->setLabel($data['label']); $share->setSendPasswordByTalk((bool)$data['password_by_talk']); $share->setHideDownload((bool)$data['hide_download']); @@ -1140,7 +1140,6 @@ class ShareByMailProvider implements IShareProvider { * @throws ShareNotFound */ protected function getRawShare($id) { - // Now fetch the inserted share and create a complete share object $qb = $this->dbConnection->getQueryBuilder(); $qb->select('*') diff --git a/apps/workflowengine/lib/Check/RequestTime.php b/apps/workflowengine/lib/Check/RequestTime.php index b7a2f725451..be28f8ead15 100644 --- a/apps/workflowengine/lib/Check/RequestTime.php +++ b/apps/workflowengine/lib/Check/RequestTime.php @@ -109,12 +109,12 @@ class RequestTime implements ICheck { } $values = json_decode($value, true); - $time1 = \DateTime::createFromFormat('H:i e', $values[0]); + $time1 = \DateTime::createFromFormat('H:i e', (string)$values[0]); if ($time1 === false) { throw new \UnexpectedValueException($this->l->t('The given start time is invalid'), 3); } - $time2 = \DateTime::createFromFormat('H:i e', $values[1]); + $time2 = \DateTime::createFromFormat('H:i e', (string)$values[1]); if ($time2 === false) { throw new \UnexpectedValueException($this->l->t('The given end time is invalid'), 4); } |