You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/Parser/MimeDir.php
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,11 @@
26
26
*/
27
27
class MimeDir extends Parser
28
28
{
29
+
publicconstTOKEN_PROPNAME = 1;
30
+
publicconstTOKEN_PROPVALUE = 2;
31
+
publicconstTOKEN_PARAMNAME = 3;
32
+
publicconstTOKEN_PARAMVALUE = 4;
33
+
29
34
/**
30
35
* The input stream.
31
36
*
@@ -360,6 +365,12 @@ protected function readProperty(string $line)
360
365
'value' => null,
361
366
];
362
367
368
+
/*
369
+
* Keep track on the last token we parsed in order to do
370
+
* better error checking
371
+
*/
372
+
$lastToken = null;
373
+
363
374
$lastParam = null;
364
375
365
376
/*
@@ -385,10 +396,16 @@ protected function readProperty(string $line)
385
396
// option is set to ignore invalid lines, we ignore this line
386
397
// This can happen when servers provide faulty data as iCloud
387
398
// frequently does with X-APPLE-STRUCTURED-LOCATION
399
+
$lastToken = self::TOKEN_PARAMVALUE;
388
400
continue;
389
401
}
390
402
thrownewParseException('Invalid Mimedir file. Line starting at '.$this->startLine.' did not follow iCalendar/vCard conventions');
391
403
}
404
+
405
+
if ('=' == $match[0][0] && self::TOKEN_PARAMNAME != $lastToken) {
406
+
thrownewParseException('Invalid Mimedir file. Line starting at '.$this->startLine.': Missing parameter name for parameter value "'.$match['paramValue'].'"');
407
+
}
408
+
392
409
if (\is_null($property['parameters'][$lastParam])) {
0 commit comments