Possible fix for 'errno=8,errstr=Undefined offset: 13,errfile=load_cache-modules...
authorRoland Häder <roland@mxchange.org>
Sun, 14 Feb 2010 23:40:52 +0000 (23:40 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 14 Feb 2010 23:40:52 +0000 (23:40 +0000)
inc/loader/load_cache-modules.php
inc/wrapper-functions.php

index 9058039..052d993 100644 (file)
@@ -53,22 +53,20 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i
        // Rewrite module cache
        $modArray = $GLOBALS['cache_array']['modules'];
        foreach ($modArray['module'] as $key => $mod) {
-               $GLOBALS['cache_array']['modules']['id'][$mod] = $modArray['id'][$key];
-               unset($GLOBALS['cache_array']['modules']['id'][$key]);
-               $GLOBALS['cache_array']['modules']['title'][$mod] = $modArray['title'][$key];
-               unset($GLOBALS['cache_array']['modules']['title'][$key]);
-               $GLOBALS['cache_array']['modules']['locked'][$mod] = $modArray['locked'][$key];
-               unset($GLOBALS['cache_array']['modules']['locked'][$key]);
-               $GLOBALS['cache_array']['modules']['hidden'][$mod] = $modArray['hidden'][$key];
-               unset($GLOBALS['cache_array']['modules']['hidden'][$key]);
-               $GLOBALS['cache_array']['modules']['admin_only'][$mod] = $modArray['admin_only'][$key];
-               unset($GLOBALS['cache_array']['modules']['admin_only'][$key]);
-               $GLOBALS['cache_array']['modules']['mem_only'][$mod] = $modArray['mem_only'][$key];
-               unset($GLOBALS['cache_array']['modules']['mem_only'][$key]);
-               if (isset($GLOBALS['cache_array']['modules']['has_menu'][$key])) {
-                       $GLOBALS['cache_array']['modules']['has_menu'][$mod] = $modArray['has_menu'][$key];
-                       unset($GLOBALS['cache_array']['modules']['has_menu'][$key]);
-               } // END - if
+               // Add all
+               foreach (array('id','title','locked','hidden','admin_only','mem_only','has_menu') as $entry) {
+                       // Is the entry set?
+                       if (isset($GLOBALS['cache_array']['modules'][$entry][$key])) {
+                               // Transfer it
+                               $GLOBALS['cache_array']['modules'][$entry][$mod] = $modArray[$entry][$key];
+
+                               // And delete cache
+                               unset($GLOBALS['cache_array']['modules'][$entry][$key]);
+                       } else {
+                               // Log this for debug purposes
+                               debugLogMessage('[' . basename(__FILE__) . ':' . __LINE__ . '] Entry not found. module=' . $mod . ',key=' . $key . ',entry=' . $entry);
+                       }
+               } // END - foreach
        } // END - foreach
        unset($modArray);
 } elseif (getOutputMode() != 1) {
index 9de0106..6cbb71e 100644 (file)
@@ -402,6 +402,7 @@ function copyFileVerified ($source, $dest, $chmod = '') {
 // Send a header but checks before if we can do so
 function sendHeader ($header) {
        // Send the header
+       //* DEBUG: */ logDebugMessage(__FUNCTION__ . ': header=' . $header);
        $GLOBALS['header'][] = trim($header);
 }