[BUGFIX] Warning on fetching undefined category definitions
authorOliver Hader <oliver@typo3.org>
Sat, 21 Jul 2012 11:29:58 +0000 (13:29 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 26 Jul 2012 21:51:41 +0000 (23:51 +0200)
Calling t3lib_category_Registry::getDatabaseTableDefinition()
for an extension that does not register any categories, will
cause a PHP Warning.

Change-Id: Id44022bcdca4484a2798777bcb9139fe070935e0
Fixes: #39155
Releases: 6.0
Reviewed-on: http://review.typo3.org/12968
Reviewed-by: Oliver Klee
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
t3lib/category/Registry.php

index 0962b4d..1ec44bd 100644 (file)
@@ -145,8 +145,11 @@ class t3lib_category_Registry implements t3lib_Singleton {
         * @return string
         */
        public function getDatabaseTableDefinition($extensionKey) {
-               $sql = '';
+               if (!isset($this->registry[$extensionKey]) || !is_array($this->registry[$extensionKey])) {
+                       return '';
+               }
 
+               $sql = '';
                foreach ($this->registry[$extensionKey] as $tableName => $fieldName) {
                        $sql .= sprintf($this->template, $tableName, $fieldName);
                }