Bug #79955

Warning in SessionService Length parameter must be greater than 0

Added by Georg Ringer almost 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
Start date:
2017-02-22
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:
Stabilization Sprint

Description

Getting the error

#1476107295: PHP Warning: fread(): Length parameter must be greater than 0 in /app/vendor/typo3/cms/typo3/sysext/install/Classes/Service/SessionService.php line 392 (More information)

however don't really know how to reproduce

Associated revisions

Revision 653e22f6 (diff)
Added by Timo Hund almost 3 years ago

[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 <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

History

#1 Updated by Timo Hund almost 3 years ago

  • Assignee set to Timo Hund

I'll have a look at this

#2 Updated by Timo Hund almost 3 years ago

I had a look at this issue and figured out the following:

1. The error happens when somehow :D an empty session file is generated in "typo3temp/var/InstallToolSessions/<sessionFolder>/hash_<sessionName>

I would say a fix should be to check if result of filesize is not 0 and not false:

$length = filesize($sessionFile);
if(!empty($length)) {
   $content = fread($fd, $length);
}

What i currently don't understand, how this could happen. One possible reason is that for example the write method is
interrupted between "ftruncate" and "fwrite" which would result in a left empty file. If you force this by terminating the write process randomly at that point you have the desrcibed problem. Once an empty session file is there you continuesly have this error message in the install tool. By now i did not find another way to reproduce this.

Another way to force the error is to just truncate the file on the filesystem.

#3 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51835

#4 Updated by Gerrit Code Review almost 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51835

#5 Updated by Gerrit Code Review almost 3 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51835

#6 Updated by Timo Hund almost 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF