1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Type checks for db_verify::prepareResults()

This commit is contained in:
Nick Liu
2020-01-17 20:58:03 +01:00
parent ce510159a9
commit 1d72d48a35

View File

@@ -130,12 +130,14 @@ class db_verify
*/ */
private function diffStructurePermissive($expected, $actual) private function diffStructurePermissive($expected, $actual)
{ {
$expected['default'] = isset($expected['default']) ? $expected['default'] : '';
$actual['default'] = isset($actual['default']) ? $actual['default'] : '';
if($expected['type'] === 'JSON') // Fix for JSON alias MySQL 5.7+ if($expected['type'] === 'JSON') // Fix for JSON alias MySQL 5.7+
{ {
$expected['type'] = 'LONGTEXT'; $expected['type'] = 'LONGTEXT';
} }
// Permit actual text types that default to null even when // Permit actual text types that default to null even when
// expected does not explicitly default to null // expected does not explicitly default to null
if(0 === strcasecmp($expected['type'], $actual['type']) && if(0 === strcasecmp($expected['type'], $actual['type']) &&
@@ -410,7 +412,7 @@ class db_verify
{ {
$this->{$results}[$tbl][$key]['_status'] = 'ok'; $this->{$results}[$tbl][$key]['_status'] = 'ok';
if(!is_array($sqlData[$type][$key])) if(!isset($sqlData[$type][$key]) || !is_array($sqlData[$type][$key]))
{ {
$this->errors[$tbl]['_status'] = 'error'; // table status $this->errors[$tbl]['_status'] = 'error'; // table status
$this->{$results}[$tbl][$key]['_status'] = "missing_$type"; // type status $this->{$results}[$tbl][$key]['_status'] = "missing_$type"; // type status