[mapguide-commits] r8122 - branches/2.6/MgDev/Web/src/schemareport

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu May 8 10:37:31 PDT 2014


Author: jng
Date: 2014-05-08 10:37:30 -0700 (Thu, 08 May 2014)
New Revision: 8122

Modified:
   branches/2.6/MgDev/Web/src/schemareport/displayschema.php
Log:
#2444: Fix deprecated usage of preg_replace() in PHP 5.5

Modified: branches/2.6/MgDev/Web/src/schemareport/displayschema.php
===================================================================
--- branches/2.6/MgDev/Web/src/schemareport/displayschema.php	2014-05-08 17:34:51 UTC (rev 8121)
+++ branches/2.6/MgDev/Web/src/schemareport/displayschema.php	2014-05-08 17:37:30 UTC (rev 8122)
@@ -68,18 +68,28 @@
                 // cannot contain the translated or encoded characters. This replaces '-xffXX-' with 'ffXX' for that
                 // particular string while the rest of the encoded chars are translated properly.
                 $subXml = substr($xml, strpos($xml, 'xs:element'), -1);
-                $subXml = preg_replace("/-x([A-Za-z0-9]{1,4})-/e", "html_entity_decode('&#'.hexdec('$1').';',ENT_NOQUOTES,'UTF-8')", $subXml);
-                $subXml = preg_replace("/_x([A-Za-z0-9]{1,4})-/e", "html_entity_decode('&#'.hexdec('$1').';',ENT_NOQUOTES,'UTF-8')", $subXml);
+                $subXml = preg_replace_callback("/-x([A-Za-z0-9]{1,4})-/", function($m) {
+                    return html_entity_decode('&#'.hexdec($m[1]).';',ENT_NOQUOTES,'UTF-8');
+                }, $subXml);
+                $subXml = preg_replace_callback("/_x([A-Za-z0-9]{1,4})-/", function($m) {
+                    return html_entity_decode('&#'.hexdec($m[1]).';',ENT_NOQUOTES,'UTF-8');
+                }, $subXml);
                 $xml = substr_replace($xml, $subXml, strpos($xml, 'xs:element'), -1);
 
                 $nameSpaceStart = strpos($xml, 'targetNamespace="');
                 $nameSpaceEnd = strpos($xml, '"', $nameSpaceStart+17);
                 $nameSpace = substr($xml, $nameSpaceStart, $nameSpaceEnd-$nameSpaceStart);
-                $nameSpaceModified = preg_replace("/-x([A-Za-z0-9]{1,4})-/e", "html_entity_decode('&#'.hexdec('$1').';',ENT_NOQUOTES,'UTF-8')", $nameSpace);
-                $nameSpaceModified = preg_replace("/_x([A-Za-z0-9]{1,4})-/e", "html_entity_decode('&#'.hexdec('$1').';',ENT_NOQUOTES,'UTF-8')", $nameSpace);
+                $nameSpaceModified = preg_replace_callback("/-x([A-Za-z0-9]{1,4})-/", function($m) {
+                    return html_entity_decode('&#'.hexdec($m[1]).';',ENT_NOQUOTES,'UTF-8');
+                }, $nameSpace);
+                $nameSpaceModified = preg_replace_callback("/_x([A-Za-z0-9]{1,4})-/", function($m) {
+                    return html_entity_decode('&#'.hexdec($m[1]).';',ENT_NOQUOTES,'UTF-8');
+                }, $nameSpace);
 
                 $xml = str_replace($nameSpace, $nameSpaceModified, $xml);
-                $xml = preg_replace("/-x([A-Za-z0-9]{1,4})-/e", "'$1'", $xml);
+                $xml = preg_replace_callback("/-x([A-Za-z0-9]{1,4})-/", function($m) {
+                    return $m[1];
+                }, $xml);
 
                 $xsl_file = 'displayschema.xsl';
 



More information about the mapguide-commits mailing list