From 23e34b5392cff0a51784474cd0d37b1ac4bc7a23 Mon Sep 17 00:00:00 2001 From: "Alexandros C. Couloumbis" Date: Wed, 27 Nov 2019 18:09:58 +0200 Subject: [PATCH] fix php5 compatibility --- class/xml/tree/Node.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/class/xml/tree/Node.php b/class/xml/tree/Node.php index 36b49d8..7fd0058 100644 --- a/class/xml/tree/Node.php +++ b/class/xml/tree/Node.php @@ -550,6 +550,7 @@ class XML_Tree_Node { $xml ); + if(function_exists('preg_replace_callback_array')){ $xml = preg_replace_callback_array( [ "/\&([a-z\d\#]+)\;/i" => function($matches) { @@ -565,6 +566,20 @@ class XML_Tree_Node { return '&#'.ord($matches[1]).';'; } ], $xml); + } + else { + $xml = preg_replace(array("/\&([a-z\d\#]+)\;/i", + "/\&/", + "/\#\|\|([a-z\d\#]+)\|\|\#/i", + "/([^a-zA-Z\d\s\<\>\&\;\.\:\=\"\-\/\%\?\!\'\(\)\[\]\{\}\$\#\+\,\@_])/e" + ), + array("#||\\1||#", + "&", + "'&#'.ord('\\1').';'" + ), + $xml + ); + } return $xml; } -- 2.35.1