Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/CalDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function updateCalendar($calendarId, PropPatch $propPatch)
switch ($propertyName) {
case '{'.CalDAV\Plugin::NS_CALDAV.'}schedule-calendar-transp':
$fieldName = 'transparent';
$newValues[$fieldName] = 'transparent' === $propertyValue->getValue();
$newValues[$fieldName] = 'transparent' === $propertyValue->getValue() ? 1 : 0;
break;
default:
$fieldName = $this->propertyMap[$propertyName];
Expand Down
16 changes: 16 additions & 0 deletions tests/Sabre/CalDAV/Backend/AbstractPDOTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ public function testUpdateCalendarAndFetch()
self::assertArrayHasKey($name, $calendars[0]);
self::assertEquals($value, $calendars[0][$name]);
}

// Round-trip the other direction. Regression: prior to the fix,
// the pgsql PDO driver rejected this with
// SQLSTATE[22P02]: invalid input syntax for type smallint: ""
// because updateCalendar bound a PHP bool (false) instead of int 0.
$propPatch = new PropPatch([
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('opaque'),
]);
$backend->updateCalendar($newId, $propPatch);
self::assertTrue($propPatch->commit());

$calendars = $backend->getCalendarsForUser('principals/user2');
self::assertEquals(
new CalDAV\Xml\Property\ScheduleCalendarTransp('opaque'),
$calendars[0]['{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp']
);
}

/**
Expand Down