[Pkg-owncloud-commits] [php-sabredav] 72/148: First Litmus bugs.

David Prévot taffit at moszumanska.debian.org
Wed Apr 15 01:37:17 UTC 2015


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

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

commit 836d47c7aa3937df1a707b9407d85f19f6220c35
Author: Evert Pot <me at evertpot.com>
Date:   Thu Mar 19 01:25:56 2015 -0400

    First Litmus bugs.
---
 lib/DAV/CorePlugin.php           |  6 +++++-
 lib/DAV/Xml/Request/PropFind.php | 30 +++++++++---------------------
 2 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/lib/DAV/CorePlugin.php b/lib/DAV/CorePlugin.php
index d81c9af..62a8311 100644
--- a/lib/DAV/CorePlugin.php
+++ b/lib/DAV/CorePlugin.php
@@ -320,7 +320,11 @@ class CorePlugin extends ServerPlugin {
 
         $requestBody = $request->getBodyAsString();
         if (strlen($requestBody)) {
-            $propFindXml = $this->server->xml->expect('{DAV:}propfind', $requestBody);
+            try {
+                $propFindXml = $this->server->xml->expect('{DAV:}propfind', $requestBody);
+            } catch (ParseException $e) {
+                throw new BadRequest($e->getMessage(), null, $e);
+            }
         } else {
             $propFindXml = new Xml\Request\PropFind();
             $propFindXml->allProp = true;
diff --git a/lib/DAV/Xml/Request/PropFind.php b/lib/DAV/Xml/Request/PropFind.php
index da8360d..cadfbc6 100644
--- a/lib/DAV/Xml/Request/PropFind.php
+++ b/lib/DAV/Xml/Request/PropFind.php
@@ -2,7 +2,7 @@
 
 namespace Sabre\DAV\Xml\Request;
 
-use Sabre\Xml\Element\Elements;
+use Sabre\Xml\Element\KeyValue;
 use Sabre\Xml\Reader;
 use Sabre\Xml\XmlDeserializable;
 
@@ -58,30 +58,18 @@ class PropFind implements XmlDeserializable {
 
         $self = new self();
 
-        $reader->read();
+        foreach(KeyValue::xmlDeserialize($reader) as $k=>$v) {
 
-        do {
+            switch($k) {
+                case '{DAV:}prop' :
+                    $self->properties = array_keys($v);
+                    break;
+                case '{DAV:}allprop' :
+                    $self->allProp = true;
 
-            if ($reader->nodeType === Reader::ELEMENT) {
-
-                switch($reader->getClark()) {
-
-                    case '{DAV:}allprop' :
-                        $self->allProp = true;
-                        break;
-                    case '{DAV:}prop' :
-                        $self->properties = Elements::xmlDeserialize($reader);
-                        break;
-                }
-                $reader->next();
-
-            } else {
-                $reader->read();
             }
 
-        } while ($reader->nodeType !== Reader::END_ELEMENT);
-
-        $reader->read();
+        }
         return $self;
 
     }

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



More information about the Pkg-owncloud-commits mailing list