]> git.mjollnir.org Git - moodle.git/commitdiff
Fix small bug only reproduced in tests about changing field names and
authorstronk7 <stronk7>
Thu, 15 Mar 2007 20:02:17 +0000 (20:02 +0000)
committerstronk7 <stronk7>
Thu, 15 Mar 2007 20:02:17 +0000 (20:02 +0000)
xmldb_field object becoming modified. Novice OOP bug :-(

Merged from MODLE_18_STABLE

lib/xmldb/classes/generators/mysql/mysql.class.php

index 2d0c5546dc9cd7b301bbc296f053ad3cea9d9115..312d5c7298ab289f39c82f17d24a45d30e9bf58c 100644 (file)
@@ -203,11 +203,14 @@ class XMLDBmysql extends XMLDBGenerator {
 
         $results = array();  //Array where all the sentences will be stored
 
+    /// Need a clone of xmldb_field to perform the change leaving original unmodified
+        $xmldb_field_clone = clone($xmldb_field);
+
     /// Change the name of the field to perform the change
-        $xmldb_field->setName($xmldb_field->getName() . ' ' . $newname);
+        $xmldb_field_clone->setName($xmldb_field_clone->getName() . ' ' . $newname);
 
         $results[] = 'ALTER TABLE ' . $this->getTableName($xmldb_table) . ' CHANGE ' .
-                     $this->getFieldSQL($xmldb_field);
+                     $this->getFieldSQL($xmldb_field_clone);
 
         return $results;
     }