]> git.mjollnir.org Git - moodle.git/commitdiff
Now XMLDBStatements support backslashed single quotes.
authorstronk7 <stronk7>
Tue, 27 Mar 2007 20:31:18 +0000 (20:31 +0000)
committerstronk7 <stronk7>
Tue, 27 Mar 2007 20:31:18 +0000 (20:31 +0000)
Merged from MOODLE_18_STABLE

lib/xmldb/classes/XMLDBObject.class.php

index a365f863bcc4a7bea715b1d5e4796c7263760c7a..10a90b971a24d9d713cd27bcd37199fb796b587e 100644 (file)
@@ -372,8 +372,9 @@ class XMLDBObject {
             $string = str_replace($foundconcats,array_keys($foundconcats),$string);
         }
 
-    /// Extract all the quoted elements from the string
-        preg_match_all("/('.*?')/is", $string, $matches);
+    /// Extract all the quoted elements from the string (skipping 
+    /// backslashed quotes that are part of the content.
+        preg_match_all("/('.*?[^\\\]')/is", $string, $matches);
         foreach (array_unique($matches[0]) as $key=>$value) {
             $foundquotes['<%'.$key.'%>'] = $value;
         }
@@ -397,7 +398,8 @@ class XMLDBObject {
                 if (!empty($foundconcats)) {
                     $element = str_replace(array_keys($foundconcats), $foundconcats, $element);
                 }
-                $arr[$key] = $element;
+            /// Delete any backslash used for quotes. XMLDB stuff will add them before insert
+                $arr[$key] = str_replace("\\'", "'", $element);
             }
         }