From 653e22f648a8a0f13f92271c5abe7fb895d388c6 Mon Sep 17 00:00:00 2001
From: Timo Schmidt <timo.hund@yahoo.com>
Date: Fri, 24 Feb 2017 16:38:36 +0100
Subject: [PATCH] [BUGFIX] Installtool blocked when session file is empty

When the session information is fetched from the file system it can
happen that the session file is empty.

We should check for the file length and only read it, when the file
length is larger then 0.

Change-Id: I8857efc54f76c56984bc3486064b622b05e488b8
Resolves: #79955
Releases: master
Reviewed-on: https://review.typo3.org/51835
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
---
 typo3/sysext/install/Classes/Service/SessionService.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/install/Classes/Service/SessionService.php b/typo3/sysext/install/Classes/Service/SessionService.php
index 1d5257f073c7..112a7bcb9d98 100644
--- a/typo3/sysext/install/Classes/Service/SessionService.php
+++ b/typo3/sysext/install/Classes/Service/SessionService.php
@@ -389,7 +389,10 @@ class SessionService implements \TYPO3\CMS\Core\SingletonInterface
             if ($fd = fopen($sessionFile, 'rb')) {
                 $lockres = flock($fd, LOCK_SH);
                 if ($lockres) {
-                    $content = fread($fd, filesize($sessionFile));
+                    $length = filesize($sessionFile);
+                    if ($length > 0) {
+                        $content = fread($fd, $length);
+                    }
                     flock($fd, LOCK_UN);
                 }
                 fclose($fd);
-- 
GitLab