PUT fails on events with dates far in the future
Hi,
there's an issue in the write_resource
function in caldav-PUT-functions.php
. There's a strange regex for on date only values:
https://gitlab.com/davical-project/davical/-/blob/master/inc/caldav-PUT-functions.php#L1471
if (preg_match("/^1[0-8][0-9][0-9][01][0-9][0-3][0-9]$/", $dtstart))
$dtstart = $dtstart . "T000000Z";
The code looks like it'd only accept 18991939 as the biggest value. I have no clue why it's 1899? There must be something else as adding dates after 1899 obviously works, but something around 2100 fails. So I guess it's not related at all.
==> postgresql/postgresql-11-main.log <==
2020-09-15 10:41:53 GMT ERROR: column "dtstart" is of type timestamp with time zone but expression is of type integer at character 623
2020-09-15 10:41:53 GMT HINT: You will need to rewrite or cast the expression.
2020-09-15 10:41:53 GMT STATEMENT: INSERT INTO calendar_item (user_no, dav_name, dav_id, dav_etag, uid, dtstamp,
dtstart, dtend, summary, location, class, transp,
description, rrule, tz_id, last_modified, url, priority,
created, due, percent_complete, status, collection_id,
first_instance_start, last_instance_end )
VALUES ( 1005, '/foo/bar/20200915-104153-ddb2ce4c8eaa2d0c409e7cf8c95ca543@iserv.lan.mein-iserv.de.ics', 39166, '6124d2294156cb4d43a35678d51b293c', '20200915-104153-ddb2ce4c8eaa2d0c409e7cf8c95ca543@iserv.lan.mein-iserv.de', '20200915T104153Z',
21110917, 21110918, 'tada', NULL, 'PUBLIC', 'OPAQUE',
NULL, NULL, NULL, '20200915T104153Z', NULL, NULL,
'20200915T104153Z', NULL, NULL, NULL, 38958,
'21110917T000000Z', '21110918T000000Z')
The date 21110917
get's treated as an integer. Due to some mysterious PostgreSQL behaviour? Perhaps just some missing quoting? We're running Postgres 11 at the moment.
Kind regard Matthias