Index: kernel/classes/ezcache.php
===================================================================
--- kernel/classes/ezcache.php	(revision 24327)
+++ kernel/classes/ezcache.php	(working copy)
@@ -61,13 +61,19 @@
         if ( !isset( $cacheList ) )
         {
             $ini = eZINI::instance();
+            $contentCachePath = $ini->variable( 'ContentSettings', 'CacheDir' );
+            $contentCacheIsValid = self::contentCacheIsValid( $contentCachePath );
+
             $textToImageIni = eZINI::instance( 'texttoimage.ini' );
+            $textToImageCachePath = $textToImageIni->variable( 'PathSettings', 'CacheDir' );
+            $textToImageCacheIsValid = self::textToImageCacheIsValid( $textToImageCachePath );
+
             $cacheList = array( array( 'name' => ezi18n( 'kernel/cache', 'Content view cache' ),
                                        'id' => 'content',
                                        'tag' => array( 'content' ),
                                        'expiry-key' => 'content-view-cache',
-                                       'enabled' => $ini->variable( 'ContentSettings', 'ViewCaching' ) == 'enabled',
-                                       'path' => $ini->variable( 'ContentSettings', 'CacheDir' ),
+                                       'enabled' => ( $ini->variable( 'ContentSettings', 'ViewCaching' ) == 'enabled' and $contentCacheIsValid ),
+                                       'path' => $contentCachePath,
                                        'function' => array( 'eZCache', 'clearContentCache' ) ),
                                 array( 'name' => ezi18n( 'kernel/cache', 'Global INI cache' ),
                                        'id' => 'global_ini',
@@ -143,8 +149,8 @@
                                 array( 'name' => ezi18n( 'kernel/cache', 'Text to image cache' ),
                                        'id' => 'texttoimage',
                                        'tag' => array( 'template' ),
-                                       'enabled' => $textToImageIni->variable( 'ImageSettings', 'UseCache' ) == 'enabled',
-                                       'path' => $textToImageIni->variable( 'PathSettings', 'CacheDir' ),
+                                       'enabled' => ( $textToImageIni->variable( 'ImageSettings', 'UseCache' ) == 'enabled' and $textToImageCacheIsValid ),
+                                       'path' => $textToImageCachePath,
                                        'function' => array( 'eZCache', 'clearTextToImageCache' ),
                                        'purge-function' => array( 'eZCache', 'purgeTextToImageCache' ) ),
                                 array( 'name' => ezi18n( 'kernel/cache', 'RSS cache' ),
@@ -185,6 +191,38 @@
 
     /*!
      \static
+     Performs sanity checks on the content cache path string.
+     \return \c false if there is a problem, \c true otherwise.
+     \param $path The path string to check.
+    */
+    static function contentCacheIsValid( $path )
+    {
+        if ( $path[0] == '/' )
+        {
+            eZDebug::writeError( "Content cache path '$path' is invalid. It should be a subdir of the global cache dir, and it cannot start with a slash. Please check site.ini [ContentSettings] CacheDir!", __METHOD__ );
+            return false;
+        }
+        return true;
+    }
+
+    /*!
+     \static
+     Performs sanity checks on the texttoimage cache path string.
+     \return \c false if there is a problem, \c true otherwise.
+     \param $path The path string to check.
+    */
+    static function textToImageCacheIsValid( $path )
+    {
+        if ( $path == '/' )
+        {
+            eZDebug::writeError( "Text to image cache path '$path' is invalid. It cannot be the root directory. Please check texttoimage.ini [PathSettings] CacheDir!", __METHOD__ );
+            return false;
+        }
+        return true;
+    }
+
+    /*!
+     \static
      Goes through the cache info list \a $cacheInfoList and finds all the unique tags.
      \return An array with tag strings.
      \param $cacheInfoList If \c false the list will automatically be fetched, if multiple
@@ -380,6 +418,12 @@
             }
         }
 
+        if ( $cacheItem['path'] == '/' )
+        {
+            eZDebug::writeError( "Refusing to delete '/', please check the cache directory setting for " . $cacheItem['id'] . "!", __METHOD__ );
+            return;
+        }
+
         $cacheItem['purge']          = $purge;
         $cacheItem['reporter']       = $reporter;
         $cacheItem['iterationSleep'] = $iterationSleep;
@@ -587,6 +631,11 @@
     */
     static function purgeTextToImageCache( $cacheItem )
     {
+        if ( $cacheItem['path'] == '/' )
+        {
+            eZDebug::writeError( "Refusing to delete '/', please check texttoimage.ini [PathSettings] CacheDir!", __METHOD__ );
+            return;
+        }
         $fileHandler = eZClusterFileHandler::instance( $cacheItem['path'] );
         $fileHandler->purge();
     }
