Skip to content

Commit 192d94d

Browse files
authored
Merge pull request #726 from KristofferFM/kristoffer-moellerhoej-improved-check-on-property-name
Improved check on property name
2 parents 9f217d9 + 6eee31d commit 192d94d

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/Parser/MimeDir.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ protected function readProperty(string $line)
415415
$property['value'] = $match['propValue'];
416416
continue;
417417
}
418-
if (isset($match['name']) && $match['name']) {
418+
if (isset($match['name']) && 0 < strlen($match['name'])) {
419419
$property['name'] = strtoupper($match['name']);
420420
continue;
421421
}
@@ -428,7 +428,7 @@ protected function readProperty(string $line)
428428
if (\is_null($property['value'])) {
429429
$property['value'] = '';
430430
}
431-
if (!$property['name']) {
431+
if (!isset($property['name']) || 0 == strlen($property['name'])) {
432432
if ($this->options & self::OPTION_IGNORE_INVALID_LINES) {
433433
return false;
434434
}

tests/VObject/Parser/MimeDirTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,21 @@ public function provideBrokenVCalendar(): array
259259
EOF,
260260
]];
261261
}
262+
263+
public function testPropertyName0(): void
264+
{
265+
$iCal = <<<EOF
266+
BEGIN:VCALENDAR
267+
VERSION:2.0
268+
PRODID:PRODID
269+
BEGIN:VEVENT
270+
0:test
271+
END:VEVENT
272+
END:VCALENDAR
273+
EOF;
274+
275+
$mimeDir = new MimeDir();
276+
$vevent = $mimeDir->parse($iCal);
277+
self::assertEquals('test', $vevent->VEVENT->{0}->getValue());
278+
}
262279
}

0 commit comments

Comments
 (0)