[Pkg-owncloud-commits] [php-sabre-vobject] 42/43: Now throwing an exception for issue #254.

David Prévot taffit at moszumanska.debian.org
Sat Sep 5 15:23:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 4.0.0-alpha2
in repository php-sabre-vobject.

commit 55a781401f3f7b4a4894b8a473fea5d702ee7eb0
Author: Evert Pot <me at evertpot.com>
Date:   Mon Aug 31 11:57:44 2015 +0200

    Now throwing an exception for issue #254.
---
 CHANGELOG.md                              | 2 ++
 lib/Parser/MimeDir.php                    | 3 +++
 tests/VObject/IssueUndefinedIndexTest.php | 3 +++
 3 files changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d63aff..0d64e2f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ ChangeLog
 * Added a duplicate vcard merging tool for the command line.
 * #253: `isInTimeRange()` now correctly handles events that throw the
   `NoInstancesException` exception. (@migrax, @DominikTo)
+* #254: The parser threw an `E_NOTICE` for certain invalid objects. It now
+  correctly throws a `ParseException`.
 
 
 4.0.0-alpha1 (2015-07-17)
diff --git a/lib/Parser/MimeDir.php b/lib/Parser/MimeDir.php
index 986708f..a98a0f0 100644
--- a/lib/Parser/MimeDir.php
+++ b/lib/Parser/MimeDir.php
@@ -344,6 +344,9 @@ class MimeDir extends Parser {
 
                 $value = $this->unescapeParam($value);
 
+                if (is_null($lastParam)) {
+                    throw new ParseException('Invalid Mimedir file. Line starting at ' . $this->startLine . ' did not follow iCalendar/vCard conventions');
+                }
                 if (is_null($property['parameters'][$lastParam])) {
                     $property['parameters'][$lastParam] = $value;
                 } elseif (is_array($property['parameters'][$lastParam])) {
diff --git a/tests/VObject/IssueUndefinedIndexTest.php b/tests/VObject/IssueUndefinedIndexTest.php
index 950c604..9b6292e 100644
--- a/tests/VObject/IssueUndefinedIndexTest.php
+++ b/tests/VObject/IssueUndefinedIndexTest.php
@@ -4,6 +4,9 @@ namespace Sabre\VObject;
 
 class IssueUndefinedIndexTest extends \PHPUnit_Framework_TestCase {
 
+    /**
+     * @expectedException \Sabre\VObject\ParseException
+     */
     function testRead() {
 
         $input = <<<VCF

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list