mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-15071 Fixes a regular expression in xmldb_object which breaks sentences with empty strings, it is possible to specify record id in statement (needed for database moving) - by Andrei Bautu
This commit is contained in:
parent
28a40b5ca2
commit
8e768c6d64
@ -414,7 +414,7 @@ class xmldb_object {
|
||||
|
||||
/// Extract all the quoted elements from the string (skipping
|
||||
/// backslashed quotes that are part of the content.
|
||||
preg_match_all("/('.*?[^\\\]')/is", $string, $matches);
|
||||
preg_match_all("/(''|'.*?[^\\\\]')/is", $string, $matches);
|
||||
foreach (array_unique($matches[0]) as $key=>$value) {
|
||||
$foundquotes['<%'.$key.'%>'] = $value;
|
||||
}
|
||||
|
@ -153,11 +153,13 @@ class xmldb_statement extends xmldb_object {
|
||||
$fields = $this->getFieldsFromInsertSentence($sentence);
|
||||
$values = $this->getValuesFromInsertSentence($sentence);
|
||||
/// Check that we aren't inserting the id field
|
||||
/* //ids should be the same when moving database
|
||||
if (in_array('id', $fields)) {
|
||||
$this->errormsg = 'Cannot insert the "id" field. It is an autonumeric column';
|
||||
$this->debug($this->errormsg);
|
||||
$result = false;
|
||||
}
|
||||
*/
|
||||
if ($result && count($fields) == 0) {
|
||||
$this->errormsg = 'Missing fields in sentence "' . $sentence . '"';
|
||||
$this->debug($this->errormsg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user