File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
tests/VObject/Property/ICalendar Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 22
33namespace Sabre \VObject \Property \ICalendar ;
44
5+ use Sabre \VObject \InvalidDataException ;
56use Sabre \VObject \Property ;
67use Sabre \Xml ;
78
@@ -198,7 +199,14 @@ public static function stringToArray($value)
198199 if (empty ($ part )) {
199200 continue ;
200201 }
201- list ($ partName , $ partValue ) = explode ('= ' , $ part );
202+
203+ $ parts = explode ('= ' , $ part );
204+
205+ if (2 !== count ($ parts )) {
206+ throw new InvalidDataException ('The supplied iCalendar RRULE part is incorrect: ' .$ part );
207+ }
208+
209+ list ($ partName , $ partValue ) = $ parts ;
202210
203211 // The value itself had multiple values..
204212 if (false !== strpos ($ partValue , ', ' )) {
Original file line number Diff line number Diff line change 44
55use PHPUnit \Framework \TestCase ;
66use Sabre \VObject \Component \VCalendar ;
7+ use Sabre \VObject \InvalidDataException ;
78use Sabre \VObject \Node ;
89use Sabre \VObject \Reader ;
910
@@ -194,6 +195,14 @@ public function testValidateStripNoFreq()
194195 );
195196 }
196197
198+ public function testUnrepairableRRule ()
199+ {
200+ $ this ->expectException (InvalidDataException::class);
201+ $ calendar = new VCalendar ();
202+ $ property = $ calendar ->createProperty ('RRULE ' , 'IAmNotARRule ' );
203+ $ property ->validate (Node::REPAIR );
204+ }
205+
197206 public function testValidateInvalidByMonthRruleWithRepair ()
198207 {
199208 $ calendar = new VCalendar ();
You can’t perform that action at this time.
0 commit comments