[Pkg-owncloud-commits] [php-sabre-vobject] 96/341: !xml Support the OPTION_FORGIVING option.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:37 UTC 2015


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

taffit pushed a commit to branch master
in repository php-sabre-vobject.

commit a4371fc12cc8faa194af82e735e42828b4b27205
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Mon Nov 24 18:32:03 2014 +0100

    !xml Support the OPTION_FORGIVING option.
---
 lib/Parser/XML.php | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lib/Parser/XML.php b/lib/Parser/XML.php
index d8c3163..d95b0c5 100644
--- a/lib/Parser/XML.php
+++ b/lib/Parser/XML.php
@@ -51,11 +51,14 @@ class XML extends Parser {
      * @throws \Exception
      * @return Sabre\VObject\Document
      */
-    public function parse ( $input = null, $options = 0 ) {
+    public function parse($input = null, $options = 0) {
 
         if(!is_null($input))
             $this->setInput($input);
 
+        if(!is_null($options))
+            $this->options = $options;
+
         if(is_null($this->input))
             throw new EofException('End of input stream, or no input supplied');
 
@@ -63,7 +66,7 @@ class XML extends Parser {
 
             $this->root = new VCalendar([], false);
             $this->pointer = &$this->input['value'][0];
-            $this->parseVcalendarComponents($this->root, $options);
+            $this->parseVcalendarComponents($this->root);
         }
         else
             throw new \Exception('Unsupported XML standard');
@@ -75,9 +78,8 @@ class XML extends Parser {
      * Parse a vCalendar.
      *
      * @param Sabre\VObject\Component $parentComponent
-     * @param int|null $options
      */
-    protected function parseVcalendarComponents ( Component $parentComponent, $options = null ) {
+    protected function parseVcalendarComponents(Component $parentComponent) {
 
         foreach($this->pointer['value'] as $children) {
 
@@ -171,17 +173,16 @@ class XML extends Parser {
                         );
 
                         $this->pointer = &$component;
-                        $this->parseVcalendarComponents(
-                            $currentComponent,
-                            $options
-                        );
+                        $this->parseVcalendarComponents($currentComponent);
 
                         $parentComponent->add($currentComponent);
                     }
                     break;
 
                 default:
-                    throw new \Exception('XML is not well-formed: unexpected tag ' . $children['name']);
+                    if(!($this->options & self::OPTION_FORGIVING)) {
+                        throw new \Exception('XML is not well-formed: unexpected tag ' . $children['name']);
+                    }
             }
         }
     }

-- 
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