From 1ae3f9d742ba8126b9d084ed51441d00ed692c89 Mon Sep 17 00:00:00 2001 From: Anael Mobilia Date: Mon, 9 Jan 2017 11:24:15 +0100 Subject: [PATCH] Migration - addField() fix array content checks (#1561) * Issue #1476 - fix bad display of attachment's date in a ticket * Revert "Issue #1476 - fix bad display of attachment's date in a ticket" This reverts commit 2efd34c02d6c83700a24c3667536955a303286a6. * Fix 'FIRST' is added as it haven't been requested + clearly check if array case have content or not (isset not required are we create theses cases inside the function) --- inc/migration.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/migration.class.php b/inc/migration.class.php index 81d9619c405..bc062fce5af 100644 --- a/inc/migration.class.php +++ b/inc/migration.class.php @@ -331,13 +331,13 @@ function addField($table, $field, $type, $options=array()) { $format = $this->fieldFormat($type, $params['value'], $params['nodefault']); - if ($params['comment']) { + if (!empty($params['comment'])) { $params['comment'] = " COMMENT '".addslashes($params['comment'])."'"; } - if ($params['after']) { + if (!empty($params['after'])) { $params['after'] = " AFTER `".$params['after']."`"; - } else if (isset($params['first'])) { + } else if (!empty($params['first'])) { $params['first'] = " FIRST "; } @@ -346,7 +346,7 @@ function addField($table, $field, $type, $options=array()) { $this->change[$table][] = "ADD `$field` $format ".$params['comment'] ." ". $params['first'].$params['after'].""; - if (isset($params['update']) && strlen($params['update'])) { + if (!empty($params['update'])) { $this->migrationOneTable($table); $query = "UPDATE `$table` SET `$field` = ".$params['update']." ".