[Pkg-owncloud-commits] [php-sabredav] 75/148: Owner in locks is now treated as a complex xml value.

David Prévot taffit at moszumanska.debian.org
Wed Apr 15 01:37:18 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 a3d182c82c785f2de61c0df017c91629b3b65e79
Author: Evert Pot <me at evertpot.com>
Date:   Thu Mar 19 03:03:10 2015 -0400

    Owner in locks is now treated as a complex xml value.
    
    Fixes #167.
---
 lib/DAV/Xml/Property/LockDiscovery.php | 13 ++++++++-----
 lib/DAV/Xml/Request/Lock.php           |  8 +++++++-
 tests/bootstrap.php                    |  1 -
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/lib/DAV/Xml/Property/LockDiscovery.php b/lib/DAV/Xml/Property/LockDiscovery.php
index 77c7389..8b716f5 100644
--- a/lib/DAV/Xml/Property/LockDiscovery.php
+++ b/lib/DAV/Xml/Property/LockDiscovery.php
@@ -2,10 +2,13 @@
 
 namespace Sabre\DAV\Xml\Property;
 
-use Sabre\DAV;
-use Sabre\Xml\XmlSerializable;
-use Sabre\Xml\Reader;
-use Sabre\Xml\Writer;
+use
+    Sabre\DAV,
+    Sabre\Xml\Element\XmlFragment,
+    Sabre\Xml\Reader,
+    Sabre\Xml\Writer,
+    Sabre\Xml\XmlSerializable;
+
 
 /**
  * Represents {DAV:}lockdiscovery property.
@@ -95,7 +98,7 @@ class LockDiscovery implements XmlSerializable {
             $writer->writeElement('{DAV:}href', 'opaquelocktoken:' . $lock->token);
             $writer->endElement(); // {DAV:}locktoken
 
-            $writer->writeElement('{DAV:}owner', $lock->owner);
+            $writer->writeElement('{DAV:}owner', new XmlFragment($lock->owner));
             $writer->endElement(); // {DAV:}activelock
 
         }
diff --git a/lib/DAV/Xml/Request/Lock.php b/lib/DAV/Xml/Request/Lock.php
index 9070d6e..882f843 100644
--- a/lib/DAV/Xml/Request/Lock.php
+++ b/lib/DAV/Xml/Request/Lock.php
@@ -58,9 +58,15 @@ class Lock implements XmlDeserializable {
      */
     static function xmlDeserialize(Reader $reader) {
 
+        $reader->pushContext();
+        $reader->elementMap['{DAV:}owner'] = 'Sabre\\Xml\\Element\\XmlFragment';
+
         $values = KeyValue::xmlDeserialize($reader);
+
+        $reader->popContext();
+
         $new = new self();
-        $new->owner = !empty($values['{DAV:}owner'])?$values['{DAV:}owner']:null;
+        $new->owner = !empty($values['{DAV:}owner'])?$values['{DAV:}owner']->getXml():null;
         $new->scope = LockInfo::SHARED;
 
         if (isset($values['{DAV:}lockscope'])) {
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index e254236..fdbfb99 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -9,7 +9,6 @@ $autoLoader->add('Sabre\\', __DIR__);
 // VObject tests auto loading
 $autoLoader->addPsr4('Sabre\\VObject\\',__DIR__ . '/../vendor/sabre/vobject/tests/VObject');
 
-
 date_default_timezone_set('UTC');
 
 $config = [

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