Merge pull request #5314 from MrPetovan/task/4889-fix-tests

Fix tests after enabling PHP Notices
This commit is contained in:
Michael Vogel 2018-07-06 22:14:01 +02:00 committed by GitHub
commit 3eec97aa6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 348 additions and 268 deletions

View file

@ -412,7 +412,7 @@ class DBStructure
$field_definition = $database[$name]["fields"][$fieldname];
// Define the default collation if not given
if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
if (!isset($parameters['Collation']) && !empty($field_definition['Collation'])) {
$parameters['Collation'] = 'utf8mb4_general_ci';
} else {
$parameters['Collation'] = null;
@ -536,26 +536,26 @@ class DBStructure
private static function FieldCommand($parameters, $create = true) {
$fieldstruct = $parameters["type"];
if (!is_null($parameters["Collation"])) {
if (!empty($parameters["Collation"])) {
$fieldstruct .= " COLLATE ".$parameters["Collation"];
}
if ($parameters["not null"]) {
if (!empty($parameters["not null"])) {
$fieldstruct .= " NOT NULL";
}
if (isset($parameters["default"])) {
if (!empty($parameters["default"])) {
if (strpos(strtolower($parameters["type"]),"int")!==false) {
$fieldstruct .= " DEFAULT ".$parameters["default"];
} else {
$fieldstruct .= " DEFAULT '".$parameters["default"]."'";
}
}
if ($parameters["extra"] != "") {
if (!empty($parameters["extra"])) {
$fieldstruct .= " ".$parameters["extra"];
}
if (!is_null($parameters["comment"])) {
if (!empty($parameters["comment"])) {
$fieldstruct .= " COMMENT '".dbesc($parameters["comment"])."'";
}
@ -579,7 +579,7 @@ class DBStructure
}
}
if (!is_null($structure["indexes"])) {
if (!empty($structure["indexes"])) {
foreach ($structure["indexes"] AS $indexname => $fieldnames) {
$sql_index = self::createIndex($indexname, $fieldnames, "");
if (!is_null($sql_index)) {
@ -588,11 +588,11 @@ class DBStructure
}
}
if (!is_null($structure["engine"])) {
if (!empty($structure["engine"])) {
$engine = " ENGINE=" . $structure["engine"];
}
if (!is_null($structure["comment"])) {
if (!empty($structure["comment"])) {
$comment = " COMMENT='" . dbesc($structure["comment"]) . "'";
}