-
Notifications
You must be signed in to change notification settings - Fork 96
Fixes #1009: add LAST-MODIFIED to calendardata when it is absent #1010
base: master
Are you sure you want to change the base?
Conversation
$lastModified = $vevent->__get('LAST-MODIFIED'); | ||
if (is_null($lastModified)) { | ||
$lastModified = $vevent->add('LAST-MODIFIED'); | ||
} | ||
$vevent->__get('LAST-MODIFIED')->setDateTime($now); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't a simple change of
$vevent->__get('LAST-MODIFIED')->setDateTime($now);
to
$vevent->__set('LAST-MODIFIED', $now);
be enough? That should be the identical rewrite of what happens with DTSTAMP in the line after...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx @gvde ! I've tested and it is working for me.
The problem with the LAST-MODIFIED may be present at other places as well. Should be checked everywhere if it's O.K. at all places... |
b5bc0c7
to
debe54e
Compare
There may be one problem assigning the same object to two properties: if the object is changed through one property it affects the other property as well (e.g. if the following code would somewhere modify the time zone of DTSTAMP to something else it would also change the timezone of LAST-MODIFIED). Thus, I guess to be safe, you should assign LAST-MODIFIED not $now but "clone $now" which creates a copy of the object in $now. Then DTSTAMP and LAST-MODIFIED both are set to the current time but using two different objects. |
debe54e
to
b7b8173
Compare
b7b8173
to
4f7a21c
Compare
@gvde thanks for your valuable comment! I've just pushed the update, please see if everything is okay now from your point of view. |
Looking good to me... |
to close owncloud/calendar#1009
Suggestions/critics are welcomed as my php experience is very little :-)