Fixed bug #15265: InstallTool-login not possible after Update to 4.4.1 due to session...
authorOliver Hader <oliver.hader@typo3.org>
Tue, 3 Aug 2010 15:40:23 +0000 (15:40 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 3 Aug 2010 15:40:23 +0000 (15:40 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8477 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/install/mod/class.tx_install_session.php

index 622dd8d..994e2a9 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-03  Oliver Hader  <oliver@typo3.org>
+
+       * Fixed bug #15265: InstallTool-login not possible after Update to 4.4.1 due to session_start() in extensions (thanks to Ernesto Baschny and Helmut Hummel)
+
 2010-08-02  Oliver Hader  <oliver@typo3.org>
 
        * Fixed bug #15289: Element-Browser page tree has HSC'ed <span> elements
index f71d66c..812b933 100755 (executable)
@@ -317,7 +317,11 @@ class tx_install extends t3lib_install {
                        die('Install Tool needs to write to typo3temp/. Make sure this directory is writeable by your webserver: '. $this->typo3temp_path);
                }
 
-               $this->session = t3lib_div::makeInstance('tx_install_session');
+               try {
+                       $this->session = t3lib_div::makeInstance('tx_install_session');
+               } catch (Exception $exception) {
+                       $this->outputErrorAndExit($exception->getMessage());
+               }
 
                        // *******************
                        // Check authorization
@@ -7735,6 +7739,47 @@ $out="
        }
 
        /**
+        * Outputs an error and dies.
+        * Should be used by all errors that occur before even starting the install tool process.
+        *
+        * @param string The content of the error
+        * @return void
+        */
+       protected function outputErrorAndExit($content, $title = 'Install Tool error') {
+                       // Define the stylesheet
+               $stylesheet = '<link rel="stylesheet" type="text/css" href="' .
+                       '../stylesheets/install/install.css" />';
+               $javascript = '<script type="text/javascript" src="' .
+                       '../contrib/prototype/prototype.js"></script>' . LF;
+               $javascript .= '<script type="text/javascript" src="' .
+                       '../sysext/install/Resources/Public/Javascript/install.js"></script>';
+
+                       // Get the template file
+               $template = @file_get_contents(PATH_site . '/typo3/templates/install.html');
+                       // Define the markers content
+               $markers = array(
+                       'styleSheet' => $stylesheet,
+                       'javascript' => $javascript,
+                       'title' => $title,
+                       'content' => $content,
+               );
+                       // Fill the markers
+               $content = t3lib_parsehtml::substituteMarkerArray(
+                       $template,
+                       $markers,
+                       '###|###',
+                       1,
+                       1
+               );
+                       // Output the warning message and exit
+               header('Content-Type: text/html; charset=utf-8');
+               header('Cache-Control: no-cache, must-revalidate');
+               header('Pragma: no-cache');
+               echo $content;
+               exit();
+       }
+
+       /**
         * Sends the page to the client.
         *
         * @param string $content The HTML page
index 323d6f1..a630660 100644 (file)
@@ -93,7 +93,7 @@ class tx_install_session {
                $sessionSavePath = $this->getSessionSavePath();
                if (!is_dir($sessionSavePath)) {
                        if (!t3lib_div::mkdir($sessionSavePath)) {
-                               die('Could not create session folder in typo3temp/. Make sure it is writeable!');
+                               throw new Exception('<p><strong>Could not create session folder in typo3temp/.</strong></p><p>Make sure it is writeable!</p>');
                        }
                        t3lib_div::writeFile($sessionSavePath.'/.htaccess', 'Order deny, allow'."\n".'Deny from all'."\n");
                        $indexContent = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
@@ -120,6 +120,16 @@ class tx_install_session {
                if (version_compare(phpversion(), '5.2', '<')) {
                        ini_set('session.cookie_httponly', TRUE);
                }
+               if (ini_get('session.auto_start')) {
+                       $sessionCreationError = '<p><strong>Error: session.auto-start is enabled</strong></p>';
+                       $sessionCreationError .= '<p>The PHP option session.auto-start is enabled. Disable this option in php.ini or .htaccess:</p>';
+                       $sessionCreationError .= '<pre>php_value session.auto_start Off</pre>';
+                       throw new Exception($sessionCreationError);
+               } else if (defined('SID')) {
+                       $sessionCreationError = '<p><strong>Error: Session already started by session_start().</strong></p>';
+                       $sessionCreationError .= '<p>Make sure no installed extension is starting a session in its ext_localconf.php or ext_tables.php.</p>';
+                       throw new Exception($sessionCreationError);
+               }
                session_start();
        }