From 13be7cb2b98453efae2952b4879bfd557806b702 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 6 Jun 2012 10:30:29 +1200 Subject: [PATCH] BUGFIX Ensure that enum values with a single quote are escaped correctly for PHP coming out of MySQL ('' to \'), otherwise dev/build shows these as changed all the time. --- model/MySQLDatabase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/model/MySQLDatabase.php b/model/MySQLDatabase.php index 4042af5d1..0b8a39aa3 100644 --- a/model/MySQLDatabase.php +++ b/model/MySQLDatabase.php @@ -367,7 +367,9 @@ class MySQLDatabase extends SS_Database { public function fieldList($table) { $fields = DB::query("SHOW FULL FIELDS IN \"$table\""); foreach($fields as $field) { - $fieldSpec = $field['Type']; + + // ensure that '' is converted to \' in field specification (mostly for the benefit of ENUM values) + $fieldSpec = str_replace('\'\'', '\\\'', $field['Type']); if(!$field['Null'] || $field['Null'] == 'NO') { $fieldSpec .= ' not null'; }