Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-WR-TIMEZONE causes EXDATE of series to be ignored #98

Closed
dominikschreiber opened this issue Dec 6, 2016 · 6 comments
Closed

X-WR-TIMEZONE causes EXDATE of series to be ignored #98

dominikschreiber opened this issue Dec 6, 2016 · 6 comments

Comments

@dominikschreiber
Copy link

dominikschreiber commented Dec 6, 2016

Issue Description

I'm experiencing deleted series entries of a google calendar being shown in the $ical->eventsFromRange result. In my attempt to find out why this happens, I observed that X-WR-TIMEZONE:Europe/Berlin seems to cause the EXDATE to be ignored. If you remove this line, the EXDATE has effect.

See a minimal example below.

Sadly I'm too bad of a php developer to fix this with a pull request, but I hope you can work with the information I have here.

Minimal Example

# file: basic.ics
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-TIMEZONE:Europe/Berlin
BEGIN:VEVENT
DTSTART:20161205T140000
DTEND:20161205T160000
RRULE:FREQ=MONTHLY;BYDAY=1MO
EXDATE:20170102T140000
DTSTAMP:20161206T211738Z
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
<?php // file: index.php
date_default_timezone_set('europe/berlin');
$ical = new ICal(explode("\r\n", file_get_contents("basic.ics")));
?>
<ul><?php foreach ($ical->eventsFromRange("2017-01-01", "2017-03-31") as $e) { ?>
  <li><?php echo strftime("%d.%m.%y", $ical->iCalDateToUnixTimestamp($e->dtstart)); } ?>
</ul>

Expected Result

  • 06.02.17
  • 06.03.17

Actual Result

  • 02.01.17
  • 06.02.17
  • 06.03.17
@u01jmg3 u01jmg3 self-assigned this Dec 7, 2016
@u01jmg3
Copy link
Owner

u01jmg3 commented Dec 7, 2016

  • Just ran the parser against your snippet and it produced what was expected.

x

  • As per the issue guidelines, have you checked you are using the latest version (dev-master)?

@dominikschreiber
Copy link
Author

dominikschreiber commented Dec 8, 2016

I just required dev-master again, and the following php code produces the very error I reported:

<?php
require_once "./vendor/autoload.php";

use ICal\ICal;

date_default_timezone_set('europe/berlin');
$ical = new ICal([
	"BEGIN:VCALENDAR",
	"VERSION:2.0",
	"CALSCALE:GREGORIAN",
	"METHOD:PUBLISH",
	"X-WR-TIMEZONE:Europe/Berlin",
	"BEGIN:VEVENT",
	"DTSTART:20161205T140000",
	"DTEND:20161205T160000",
	"RRULE:FREQ=MONTHLY;BYDAY=1MO",
	"EXDATE:20170102T140000",
	"DTSTAMP:20161206T211738Z",
	"SEQUENCE:0",
	"STATUS:CONFIRMED",
	"TRANSP:OPAQUE",
	"END:VEVENT",
	"END:VCALENDAR"
]);
?>
<ul><?php foreach ($ical->eventsFromRange("2017-01-01", "2017-03-31") as $e) { ?>
  <li><?php echo strftime("%d.%m.%y", $ical->iCalDateToUnixTimestamp($e->dtstart)); } ?>
</ul>

u01jmg3 added a commit that referenced this issue Dec 16, 2016
Refrain from using `gmdate()` and instead refer to supplied timezone info
@u01jmg3
Copy link
Owner

u01jmg3 commented Dec 16, 2016

@dominikschreiber: the latest dev-master should correct your issue. Can you try once last time, please?

@dominikschreiber
Copy link
Author

Hey, sorry for me appearing offensive last time. I didn't mean it, you're doing a great work on your free time, and I really want to thank you for that.

Commit f9f5866 fixes this issue. For some reason, I have a huge performance drop from commit dde72dc (~3s to load https://calendar.google.com/calendar/ical/efg.ludwigshafen%40gmail.com/public/basic.ics, parse it, and render all events in a month in a table) over f9f5866 (~15s) to 4de3963 (~45s). I'm ok with that (use it for a script running once every 2 months), but this feels quite alarming...

@u01jmg3
Copy link
Owner

u01jmg3 commented Dec 20, 2016

@dominikschreiber - glad to hear I have fixed the problem you reported in this issue. I shall look into the performance drop you mentioned (#99) and see what could be the cause.

@u01jmg3
Copy link
Owner

u01jmg3 commented Dec 20, 2016

@dominikschreiber - I have analysed all 20 commits since the release of v2.0.1 and found there to be 2 bottlenecks.

  1. One surrounded using iCalDateToUnixTimestamp() in f9f5866 which always used a regex to parse the time zone
    • This has been changed in 9d44e5c to check that a time zone exists before trying to parse it
  2. The second issue related to 48d285b and populating the DTSTART_array
    • The code was inefficient and has been improved in 9d44e5c

  • Finally it is worth noting that in b7b3ee6 the recurrence rule logic to handle EXDATE data when a count is imposed has been corrected so that EXDATEs don't count towards an imposed count.
    • This means you may have more event data resulting in increased processing times.

@u01jmg3 u01jmg3 removed their assignment Jan 6, 2017
@u01jmg3 u01jmg3 added bug-normal and removed bug labels Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants