summaryrefslogtreecommitdiffstats
path: root/XML_Util-pr8.patch
blob: 2a418933f2a892a31f7b06149533d445479138af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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(