]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/database/databases/class_LocalFileDatabase.php
Fixed searched criteria handling #3
[core.git] / inc / classes / main / database / databases / class_LocalFileDatabase.php
index ac5bbb9553d52ec6660c4a56fbcda8091715e8b7..7aa3fb359f983740957752b205021412b220bbd4 100644 (file)
@@ -348,7 +348,7 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn
 
                                // Read the file
                                $dataArray = $this->getDataArrayFromFile($pathName . $dataFile);
-                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',dataArray='.print_r($dataArray, TRUE));
+                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: dataFile=' . $dataFile . ',dataArray='.print_r($dataArray, TRUE));
 
                                // Is this an array?
                                if (is_array($dataArray)) {
@@ -357,13 +357,16 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn
 
                                        // Search in the criteria with FMFW (First Matches, First Wins)
                                        foreach ($dataArray as $key => $value) {
+                                               // Make sure value is not bool
+                                               assert(!is_bool($value));
+
                                                // Found one entry?
                                                $isFound = (($isFound === TRUE) && ($searchInstance->isCriteriaMatching($key, $value)));
-                                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: key=' . $key . ',value=' . $value . ',isFound=' . intval($isFound));
+                                               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: key=' . $key . ',value=' . $value . ',isFound=' . intval($isFound));
                                        } // END - foreach
 
                                        // Is all found?
-                                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: isFound=' . intval($isFound) . ',limitFound=' . $limitFound . ',limit=' . $searchInstance->getLimit());
+                                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: isFound=' . intval($isFound) . ',limitFound=' . $limitFound . ',limit=' . $searchInstance->getLimit());
                                        if ($isFound === TRUE) {
                                                // Shall we skip this entry?
                                                if ($searchInstance->getSkip() > 0) {
@@ -492,6 +495,9 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn
 
                                        // Search in the criteria with FMFW (First Matches, First Wins)
                                        foreach ($dataArray as $key => $value) {
+                                               // Make sure value is not bool
+                                               assert(!is_bool($value));
+
                                                // Found one entry?
                                                $isFound = (($isFound === TRUE) && ($searchInstance->isCriteriaMatching($key, $value)));
                                        } // END - foreach
@@ -510,6 +516,10 @@ class LocalFileDatabase extends BaseDatabaseBackend implements DatabaseBackendIn
 
                                                // Entry found, so update it
                                                foreach ($searchArray as $searchKey => $searchValue) {
+                                                       // Make sure the value is not bool again
+                                                       assert(!is_bool($searchValue));
+
+                                                       // Debug message + add/update it
                                                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE: criteriaKey=' . $searchKey . ',criteriaValue=' . $searchValue);
                                                        $dataArray[$searchKey] = $searchValue;
                                                } // END - foreach