OzzyCzech / icalparser

Simple ical parser for PHP
https://ozana.cz
BSD 3-Clause "New" or "Revised" License
59 stars 22 forks source link

PHP Fatal error: Uncaught Error: Typed property om\IcalParser::$timezone #60

Closed michelep closed 2 years ago

michelep commented 2 years ago

Try running test, i got this:

PHP Fatal error: Uncaught Error: Typed property om\IcalParser::$timezone must not be accessed before initialization in /vendor/om/icalparser/src/IcalParser.php:284

PHP 7.4 on Debian 11

OzzyCzech commented 2 years ago

Can you please share an ical file that cause this error, thanks

OzzyCzech commented 2 years ago

I am just releasing version v3.0.1 that should allow $timezone property to be null, hopefully that's help

michelep commented 2 years ago

ust updated but error still present. Here's the ICAL that cause the issue:

BEGIN:VCALENDAR
PRODID;X-RICAL-TZSOURCE=TZINFO:-//Airbnb Inc//Hosting Calendar 0.8.8//EN
CALSCALE:GREGORIAN
VERSION:2.0
BEGIN:VEVENT
DTEND;VALUE=DATE:20220520
DTSTART;VALUE=DATE:20220412
UID:1418fdfasfdasdfsad@airbnb.com
DESCRIPTION:Reservation URL: https://www.airbnb.com/hosting/reservations/
 details/\nPhone Number (Last 4 Digits): 0431
SUMMARY:Reserved
END:VEVENT
BEGIN:VEVENT
DTEND;VALUE=DATE:20220620
DTSTART;VALUE=DATE:20220617
UID:1418fb94e984-dfasdfasdfsdfsdfsd@airbnb.com
DESCRIPTION:Reservation URL: https://www.airbnb.com/hosting/reservations/
 details/\nPhone Number (Last 4 Digits): 2360
SUMMARY:Reserved
END:VEVENT
BEGIN:VEVENT
DTEND;VALUE=DATE:20220628
DTSTART;VALUE=DATE:20220625
UID:1418fb94e984-dafdfdfadfdfadsfasdafsd@airbnb.com
DESCRIPTION:Reservation URL: https://www.airbnb.com/hosting/reservations/
 details/\nPhone Number (Last 4 Digits): 1537
SUMMARY:Reserved
END:VEVENT
BEGIN:VEVENT
DTEND;VALUE=DATE:20220724
DTSTART;VALUE=DATE:20220723
UID:6fec1092d3fa-afdfasdfdsfasdfasdfsdfasd@airbnb.com
SUMMARY:Airbnb (Not available)
END:VEVENT
BEGIN:VEVENT
DTEND;VALUE=DATE:20220807
DTSTART;VALUE=DATE:20220725
UID:6fec1092d3fa-afdfsdfsdfasdfadsfsfs@airbnb.com
SUMMARY:Airbnb (Not available)
END:VEVENT
BEGIN:VEVENT
DTEND;VALUE=DATE:20230512
DTSTART;VALUE=DATE:20221107
UID:6fec1092d3fa-afdafdsafsdfdfsdfsd@airbnb.com
SUMMARY:Airbnb (Not available)
END:VEVENT
END:VCALENDAR
OzzyCzech commented 2 years ago

thanks for sharing

michelep commented 2 years ago

Here's the stack trace, if could help:


PHP Fatal error:  Uncaught Error: Typed property om\IcalParser::$timezone must not be accessed before initialization in /vendor/om/icalparser/src/IcalParser.php:284
Stack trace:
#0 /vendor/om/icalparser/src/IcalParser.php(128): om\IcalParser->parseRow()
#1 /vendor/om/icalparser/src/IcalParser.php(48): om\IcalParser->parseString()
#2 /cron/hourly.php(8): om\IcalParser->parseFile()
#3 {main}
  thrown in /vendor/om/icalparser/src/IcalParser.php on line 284
OzzyCzech commented 2 years ago

Seems like there was missing Timezone in ical file, because there was only dates. Latest version of parser should use current Timezone. Thanks for report