We need to have dtstart_orig be what is passed in, possibly empty.

Using quote_dt_param resolves the error that Benedikt Spranger was
fixing in 3f326f2d3fcc429d7596a4ff59970217161f7930.
This commit is contained in:
Andrew Ruthven 2024-01-20 16:42:30 +13:00
parent 9421dbd7e3
commit 435133adf5

View File

@ -1492,12 +1492,11 @@ function write_resource( DAVResource $resource, $caldav_data, DAVResource $colle
if ( $first->GetType() == 'VTODO' ) $due = $first->GetPValue('DUE');
$calitem_params[':due'] = $due;
$dtstart = $first->GetPValue('DTSTART');
$calitem_params[':dtstart_orig'] = $dtstart;
$calitem_params[':dtstart_orig'] = quote_dt_param($dtstart);
if ( empty($dtstart) ) $dtstart = $due;
if (isset($dtstart) && preg_match("/^1[0-8][0-9][0-9][01][0-9][0-3][0-9]$/", $dtstart)) {
$dtstart = $dtstart . "T000000Z";
$calitem_params[':dtstart_orig'] = $dtstart;
}
$calitem_params[':dtstart'] = quote_dt_param($dtstart);
@ -1508,7 +1507,6 @@ function write_resource( DAVResource $resource, $caldav_data, DAVResource $colle
dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $dtstart, $first->GetPValue('DURATION') );
if (preg_match("/^1[0-8][0-9][0-9][01][0-9][0-3][0-9]$/", $dtend)) {
$dtend = $dtend . "T000000Z";
$calitem_params[':dtend_orig'] = $dtend;
}
$calitem_params[':dtend'] = quote_dt_param($dtend);
$dtend = ':dtend';