diff --git a/lib/xmldb/classes/generators/mssql/mssql.class.php b/lib/xmldb/classes/generators/mssql/mssql.class.php index 5b6c7073a3a..9d92171b9da 100644 --- a/lib/xmldb/classes/generators/mssql/mssql.class.php +++ b/lib/xmldb/classes/generators/mssql/mssql.class.php @@ -229,10 +229,12 @@ class XMLDBmssql extends XMLDBgenerator { if ($xmldb_field->getEnum()) { /// Drop the current enum (not needed, it has been dropped before for msqql (in getRenameFieldSQL) //$results = array_merge($results, $this->getDropEnumSQL($xmldb_table, $xmldb_field)); - /// Change field name - $xmldb_field->setName($newname); + /// Change field name (over a clone to avoid some potential problems later) + $new_xmldb_field = clone($xmldb_field); + $new_xmldb_field->setName($newname); + /// Recreate the enum - $results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $xmldb_field)); + $results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $new_xmldb_field)); } return $results; diff --git a/lib/xmldb/classes/generators/oci8po/oci8po.class.php b/lib/xmldb/classes/generators/oci8po/oci8po.class.php index 97d462e49e3..41d5144dc17 100644 --- a/lib/xmldb/classes/generators/oci8po/oci8po.class.php +++ b/lib/xmldb/classes/generators/oci8po/oci8po.class.php @@ -214,10 +214,11 @@ class XMLDBoci8po extends XMLDBgenerator { if ($xmldb_field->getEnum()) { /// Drop the current enum $results = array_merge($results, $this->getDropEnumSQL($xmldb_table, $xmldb_field)); - /// Change field name - $xmldb_field->setName($newname); + /// Change field name (over a clone to avoid some potential problems later) + $new_xmldb_field = clone($xmldb_field); + $new_xmldb_field->setName($newname); /// Recreate the enum - $results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $xmldb_field)); + $results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $new_xmldb_field)); } return $results; diff --git a/lib/xmldb/classes/generators/postgres7/postgres7.class.php b/lib/xmldb/classes/generators/postgres7/postgres7.class.php index e24e7c48f19..6cf983b5fb5 100644 --- a/lib/xmldb/classes/generators/postgres7/postgres7.class.php +++ b/lib/xmldb/classes/generators/postgres7/postgres7.class.php @@ -370,10 +370,11 @@ class XMLDBpostgres7 extends XMLDBgenerator { if ($xmldb_field->getEnum()) { /// Drop the current enum $results = array_merge($results, $this->getDropEnumSQL($xmldb_table, $xmldb_field)); - /// Change field name - $xmldb_field->setName($newname); + /// Change field name (over a clone to avoid some potential problems later) + $new_xmldb_field = clone($xmldb_field); + $new_xmldb_field->setName($newname); /// Recreate the enum - $results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $xmldb_field)); + $results = array_merge($results, $this->getCreateEnumSQL($xmldb_table, $new_xmldb_field)); } return $results;