Skip to content

fix(caldav): only call getTimestamp() on actual DateTime data - #42696

Merged
ChristophWurst merged 1 commit into
masterfrom
fix-issue-42464
Feb 2, 2024
Merged

fix(caldav): only call getTimestamp() on actual DateTime data#42696
ChristophWurst merged 1 commit into
masterfrom
fix-issue-42464

Conversation

@tcitworld

Copy link
Copy Markdown
Member

For some reason the value of $component['DTSTART'][0] may not be a DateTimeImmutable.

In the case of #42464, the property is a Property\ICalendar\Date, but that extends Property\ICalendar\DateTime, so it should still give us a DateTimeImmutable, but anyway. 🤷

Follow-up to #42619Closes#42464

@tcitworldtcitworld added bug 3. to review Waiting for reviews feature: status feature: caldav Related to CalDAV internals labels Jan 11, 2024
@tcitworldtcitworld added this to the Nextcloud 29 milestone Jan 11, 2024
@tcitworld

Copy link
Copy Markdown
MemberAuthor

/backport to stable28

$dateTime = $component['DTSTART'][0];
$timestamp = $dateTime->getTimestamp();
if($userStatusTimestamp > $timestamp) {
if($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) {

Check notice

Code scanning / Psalm

RedundantConditionGivenDocblockType

Docblock-defined type DateTimeImmutable for $dateTime is always DateTimeImmutable
For some reason the value of $component['DTSTART'][0] may not be a DateTimeImmutable
Closes#42464
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
@ChristophWurstChristophWurst added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Feb 2, 2024
@ChristophWurst
ChristophWurst merged commit 50fffa8 into masterFeb 2, 2024
@ChristophWurst
ChristophWurst deleted the fix-issue-42464 branch February 2, 2024 11:29
@furai

furai commented Feb 2, 2024

Copy link
Copy Markdown

Isn't this line improperly formatted?

@blizzzblizzz mentioned this pull request Mar 5, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finishbugfeature: caldavRelated to CalDAV internalsfeature: status

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: NC28 CalDAV Exceptions when opening Calendar app

5 participants

@tcitworld@furai@ChristophWurst@miaulalala@github-advanced-security