]> git.mxchange.org Git - friendica.git/commitdiff
Avoid "Invalid argument supplied for foreach()"
authorMichael <heluecht@pirati.ca>
Fri, 15 May 2020 15:30:43 +0000 (15:30 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 15 May 2020 15:30:43 +0000 (15:30 +0000)
tests/DatabaseTestTrait.php

index 36636feabd57701d626d392a75d051733521a786..2b829e51ee3f9862a45a3cca32249fdec3667e5f 100644 (file)
@@ -61,7 +61,11 @@ trait DatabaseTestTrait
                $data = include $fixture;
 
                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 . '``');
                                continue;
                        }