27 lines
988 B
Diff
27 lines
988 B
Diff
|
From 59e2d9738dd25cd751b810e5431b96e836864152 Mon Sep 17 00:00:00 2001
|
||
|
From: Remi Collet <fedora@famillecollet.com>
|
||
|
Date: Wed, 22 Feb 2017 11:39:37 +0100
|
||
|
Subject: [PATCH] Fix #21184, collapseEmptyTags breaks XML_Serializer
|
||
|
|
||
|
---
|
||
|
XML/Util.php | 2 +-
|
||
|
package.xml | 1 +
|
||
|
tests/Bug21184Tests.php | 18 ++++++++++++++++++
|
||
|
3 files changed, 20 insertions(+), 1 deletion(-)
|
||
|
create mode 100644 tests/Bug21184Tests.php
|
||
|
|
||
|
diff --git a/XML/Util.php b/XML/Util.php
|
||
|
index af8211b..0bb7e5e 100644
|
||
|
--- a/XML/Util.php
|
||
|
+++ b/XML/Util.php
|
||
|
@@ -483,7 +483,7 @@ public static function collapseEmptyTags($xml, $mode = XML_UTIL_COLLAPSE_ALL)
|
||
|
'${4}' . // attributes
|
||
|
' />'
|
||
|
;
|
||
|
- return preg_replace($preg1, $preg2, $xml);
|
||
|
+ return (preg_replace($preg1, $preg2, $xml)?:$xml);
|
||
|
break;
|
||
|
case XML_UTIL_COLLAPSE_XHTML_ONLY:
|
||
|
return preg_replace(
|
||
|
|