From d26621a752bf16f0b5b38690e68bebeee4f63f27 Mon Sep 17 00:00:00 2001 From: Evert Pot Date: Fri, 20 Mar 2015 22:06:09 -0400 Subject: [PATCH] Another fix for #41. It was still broken with attributes. --- lib/Element/XmlFragment.php | 3 ++- tests/Sabre/XML/Element/XmlFragmentTest.php | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Element/XmlFragment.php b/lib/Element/XmlFragment.php index 0e0c2e9..4f4510a 100644 --- a/lib/Element/XmlFragment.php +++ b/lib/Element/XmlFragment.php @@ -83,6 +83,7 @@ function xmlSerialize(Writer $writer) { $writer->startElement( $reader->getClark() ); + $empty = $reader->isEmptyElement; while ($reader->moveToNextAttribute()) { switch($reader->namespaceURI) { case '' : @@ -96,7 +97,7 @@ function xmlSerialize(Writer $writer) { break; } } - if ($reader->isEmptyElement) { + if ($empty) { $writer->endElement(); } break; diff --git a/tests/Sabre/XML/Element/XmlFragmentTest.php b/tests/Sabre/XML/Element/XmlFragmentTest.php index 59d646c..720c7b3 100644 --- a/tests/Sabre/XML/Element/XmlFragmentTest.php +++ b/tests/Sabre/XML/Element/XmlFragmentTest.php @@ -98,6 +98,11 @@ function xmlProvider() { '', '', ], + [ + '', + '', + '', + ], ]; }