Fixing some missing is_array checks
authorWolfgang Klinger <wolfgang@stufenlos.net>
Thu, 13 Jul 2006 12:31:44 +0000 (12:31 +0000)
committerWolfgang Klinger <wolfgang@stufenlos.net>
Thu, 13 Jul 2006 12:31:44 +0000 (12:31 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1632 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_install.php

index 9065756..864b514 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-07-13 Wolfgang Klinger <wk@plan2.net>
+
+       * Fixing some missing is_array checks
+
 2006-07-12 Wolfgang Klinger <wk@plan2.net>
 
        * Fix bug/feature request #3811: Adding "ATagParams" to GMENU
index 4f09a8c..6ec0803 100755 (executable)
@@ -293,6 +293,7 @@ class t3lib_install {
        function getFieldDefinitions_sqlContent($sqlContent)    {
                $lines = t3lib_div::trimExplode(chr(10), $sqlContent,1);
                $isTable = '';
+               $total = Array();
 
                foreach($lines as $value)       {
                        if ($value[0]!='#')     {
@@ -365,35 +366,37 @@ class t3lib_install {
                                // Init SQL parser:
                        $sqlParser = t3lib_div::makeInstance('t3lib_sqlparser');
                        foreach($total as $table => $cfg)       {
-                               foreach($cfg['fields'] as $fN => $fType)        {
-                                       $orig_fType = $fType;
-                                       $fInfo = $sqlParser->parseFieldDef($fType);
-
-                                       switch($fInfo['fieldType'])     {
-                                               case 'char':
-                                               case 'varchar':
-                                                       $newSize = round($fInfo['value']*$mSize);
-
-                                                       if ($newSize <= 255)    {
-                                                               $fInfo['value'] = $newSize;
-                                                       } else {
-                                                               $fInfo = array(
-                                                                       'fieldType' => 'text',
-                                                                       'featureIndex' => array(
-                                                                               'NOTNULL' => array(
-                                                                                       'keyword' => 'NOT NULL'
+                               if (is_array($cfg['fields'])) {
+                                       foreach($cfg['fields'] as $fN => $fType)        {
+                                               $orig_fType = $fType;
+                                               $fInfo = $sqlParser->parseFieldDef($fType);
+
+                                               switch($fInfo['fieldType'])     {
+                                                       case 'char':
+                                                       case 'varchar':
+                                                               $newSize = round($fInfo['value']*$mSize);
+
+                                                               if ($newSize <= 255)    {
+                                                                       $fInfo['value'] = $newSize;
+                                                               } else {
+                                                                       $fInfo = array(
+                                                                               'fieldType' => 'text',
+                                                                               'featureIndex' => array(
+                                                                                       'NOTNULL' => array(
+                                                                                               'keyword' => 'NOT NULL'
+                                                                                       )
                                                                                )
-                                                                       )
-                                                               );
-                                                       }
-                                               break;
-                                               case 'tinytext':
-                                                       $fInfo['fieldType'] = 'text';
-                                               break;
-                                       }
+                                                                       );
+                                                               }
+                                                       break;
+                                                       case 'tinytext':
+                                                               $fInfo['fieldType'] = 'text';
+                                                       break;
+                                               }
 
-                                       $total[$table]['fields'][$fN] = $sqlParser->compileFieldCfg($fInfo);
-                                       if ($sqlParser->parse_error)    die($sqlParser->parse_error);
+                                               $total[$table]['fields'][$fN] = $sqlParser->compileFieldCfg($fInfo);
+                                               if ($sqlParser->parse_error)    die($sqlParser->parse_error);
+                                       }
                                }
                        }
                }