[Pkg-owncloud-commits] [php-sabredav] 01/12: Fixed parsing empty hrefs.
David Prévot
taffit at moszumanska.debian.org
Mon Jun 1 22:42:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag 3.0.0-beta3
in repository php-sabredav.
commit e2652b5c1936f66b463aa30bc68624f7a1eeb3a4
Author: Evert Pot <me at evertpot.com>
Date: Thu May 28 11:00:39 2015 -0400
Fixed parsing empty hrefs.
---
CHANGELOG.md | 6 ++++++
lib/DAV/Xml/Property/Href.php | 2 +-
tests/Sabre/DAV/Xml/Property/HrefTest.php | 10 ++++++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 977a6dc..7308700 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,12 @@
ChangeLog
=========
+3.0.0 (2015-??-??)
+------------------
+
+* Fixed deserializing href properties with no value.
+
+
3.0.0-beta2 (2015-05-27)
------------------------
diff --git a/lib/DAV/Xml/Property/Href.php b/lib/DAV/Xml/Property/Href.php
index 4462ee1..e37f35c 100644
--- a/lib/DAV/Xml/Property/Href.php
+++ b/lib/DAV/Xml/Property/Href.php
@@ -160,7 +160,7 @@ class Href implements Element, HtmlOutput {
static function xmlDeserialize(Reader $reader) {
$hrefs = [];
- foreach ($reader->parseInnerTree() as $elem) {
+ foreach ((array)$reader->parseInnerTree() as $elem) {
if ($elem['name'] !== '{DAV:}href')
continue;
diff --git a/tests/Sabre/DAV/Xml/Property/HrefTest.php b/tests/Sabre/DAV/Xml/Property/HrefTest.php
index c7c2805..83e9adb 100644
--- a/tests/Sabre/DAV/Xml/Property/HrefTest.php
+++ b/tests/Sabre/DAV/Xml/Property/HrefTest.php
@@ -71,6 +71,16 @@ class HrefTest extends XmlTest {
$this->assertNull($href);
}
+ function testUnserializeEmpty() {
+
+ $xml = '<?xml version="1.0"?>
+<d:anything xmlns:d="DAV:"></d:anything>
+';
+ $result = $this->parse($xml, ['{DAV:}anything' => 'Sabre\\DAV\\Xml\\Property\\Href']);
+ $href = $result['value'];
+ $this->assertNull($href);
+
+ }
/**
* This method tests if hrefs containing & are correctly encoded.
--
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