From dbd0f586a2e1929834ea7e235f99f56a84d9767e Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 15 Mar 2007 19:58:47 +0000 Subject: [PATCH] Fix small bug only reproduced in tests about changing field names and amldb_field object becoming modified. Novice OOP bug :-( --- lib/xmldb/classes/generators/mysql/mysql.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/xmldb/classes/generators/mysql/mysql.class.php b/lib/xmldb/classes/generators/mysql/mysql.class.php index 2d0c5546dc9..312d5c7298a 100644 --- a/lib/xmldb/classes/generators/mysql/mysql.class.php +++ b/lib/xmldb/classes/generators/mysql/mysql.class.php @@ -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; }