Avoid "Invalid argument supplied for foreach()"

This commit is contained in:
Michael 2020-05-15 15:30:43 +00:00
parent 8868b7f8d9
commit 2138c4bb55

View File

@ -61,7 +61,11 @@ trait DatabaseTestTrait
$data = include $fixture; $data = include $fixture;
foreach ($data as $tableName => $rows) { foreach ($data as $tableName => $rows) {
if (!is_array($rows) && !is_numeric($tableName)) { if (is_numeric($tableName)) {
continue;
}
if (!is_array($rows)) {
$dba->p('TRUNCATE TABLE `' . $tableName . '``'); $dba->p('TRUNCATE TABLE `' . $tableName . '``');
continue; continue;
} }