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;
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");
}
case 'wb':
case 'wb+':
$useExisting = false;
- // no break
+ // no break
case 'a':
case 'ab':
case 'r+':
$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']);
* @throws ShareNotFound
*/
protected function getRawShare($id) {
-
// Now fetch the inserted share and create a complete share object
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('*')
}
$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);
}