Fixed bug #4973: Check if array is empty before looping over it (thanks to Thomas...
authorMichael Stucki <michael.stucki@typo3.org>
Fri, 16 Feb 2007 11:20:56 +0000 (11:20 +0000)
committerMichael Stucki <michael.stucki@typo3.org>
Fri, 16 Feb 2007 11:20:56 +0000 (11:20 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2040 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/indexed_search/class.crawler.php

index b3d2793..1ddeca2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-02-16  Michael Stucki  <michael@typo3.org>
+
+       * Fixed bug #4973: Check if array is empty before looping over it (thanks to Thomas Oppelt)
+
 2007-02-16  Dmitry Dulepov  <dmitry@typo3.org>
 
        * Fixed bug 4962: .htaccess in sysext fails in some Apache configurations
index 7ae1c7f..fa80a83 100755 (executable)
@@ -808,15 +808,17 @@ class tx_indexedsearch_crawler {
                        // Lookup old phash rows:
                $oldPhashRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('phash','index_section', 'page_id='.intval($id));
 
-               $pHashesToDelete = array();
-               foreach ($oldPhashRows as $pHashRow)    {
-                       $pHashesToDelete[] = $pHashRow['phash'];
-               }
+               if (count($oldPhashRows))       {
+                       $pHashesToDelete = array();
+                       foreach ($oldPhashRows as $pHashRow)    {
+                               $pHashesToDelete[] = $pHashRow['phash'];
+                       }
 
-               $where_clause = 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')';
-               $tables = explode(',', 'index_debug,index_fulltext,index_grlist,index_phash,index_rel,index_section');
-               foreach ($tables as $table)     {
-                       $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where_clause);
+                       $where_clause = 'phash IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($pHashesToDelete)).')';
+                       $tables = explode(',', 'index_debug,index_fulltext,index_grlist,index_phash,index_rel,index_section');
+                       foreach ($tables as $table)     {
+                               $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where_clause);
+                       }
                }
        }