Invalid value for BYMINUTE in RRULE

78 views
Skip to first unread message

Peter Koch

unread,
Jul 15, 2016, 3:26:40 PM7/15/16
to SabreDAV Discussion
Dear SabreDAV experts,

I'm using Outlook 2010 together with the OutlookCalDAVSynchronizer
to change calendar events in our SabreDAV server.

Synchronizsation fails with the following error message:

CalDavSynchronizer.DataAccess.WebDavClientException: Response status code does not indicate success: '415' ('UnsupportedMediaType'). Message:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:sabredav-version>3.2.0-beta1</s:sabredav-version>
<s:exception>Sabre\DAV\Exception\UnsupportedMediaType</s:exception>
<s:message>Validation error in iCalendar: Invalid value for BYMINUTE in RRULE, Raw=FREQ=YEARLY;BYDAY=-1SU;BYHOUR=2;BYMINUTE=0;BYMONTH=10</s:message>
</d:error>

I searched the SabreDAV source for the string 'Invalid value for' and
found it in sabre/vobject/lib/Property/ICalendar/Recur.php at line 266.

SabreDAV chokes on a BYMINUTE-value, so I replaced line 266
'message' => 'Invalid value for ' . $key . ' in ' . $this->name,
with
'message' => 'Invalid value for ' . $key . ' in ' . $this->name . ', Raw=' . $this->getRawMimeDirValue(),

Seems like SabreDAV doesn't like BYMINUTE=0 in RRULE

Have a look at line 265:
if (empty($value)) {

Every programmer would expect that empty($var) checks wether $var is
empty or not. So did I for a couple of times in my own programs just to
learn that PHP has a strange interpretation of emtpyness.
empty() returns true if the argument does not exist or has a value that
evaluates to FALSE when casted to boolean. This has the unexpected
consequence that empty("0") is true.

I changed line 265 into: if($value==""){ and the error disappeared.

By the way: I searched through all of SabreDAVs source and found similar
usages of empty(). Maybe there are other places where empty($var)
should be changed.

Kind regards

Peter

Michael Kliewe

unread,
Jul 17, 2016, 6:14:25 PM7/17/16
to SabreDAV Discussion
Hi Peter,


Am Freitag, 15. Juli 2016 21:26:40 UTC+2 schrieb Peter Koch:
Seems like SabreDAV doesn't like BYMINUTE=0 in RRULE

Have a look at line 265:
if (empty($value)) {

Every programmer would expect that empty($var) checks wether $var is
empty or not. So did I for a couple of times in my own programs just to
learn that PHP has a strange interpretation of emtpyness.
empty() returns true if the argument does not exist or has a value that
evaluates to FALSE when casted to boolean. This has the unexpected
consequence that empty("0") is true.

I changed line 265 into: if($value==""){ and the error disappeared.

By the way: I searched through all of SabreDAVs source and found similar
usages of empty(). Maybe there are other places where empty($var)
should be changed.

Perfect description. I also found the problem 3 days ago, fixed it, sent a Pull Request on GitHub, and it has been merged by Evert on the same day.
https://github.com/fruux/sabre-vobject/commit/97ea7825ce829f45e40241b58272b9a579786119

It's in the VObject 4.1.1 release.

It would be awesome if you could tell in detail which other places are problematic. In the ideal case, write a Unit Test that fails, fix the bug, and run the test again where it's successful. And then send a Pull Request. As far as I know Evert really loves Pull Requests ;-)

Michael
Reply all
Reply to author
Forward
0 new messages