Bug #79955
Warning in SessionService Length parameter must be greater than 0
100%
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
[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>
History
#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
Applied in changeset 653e22f648a8a0f13f92271c5abe7fb895d388c6.
#7
Updated by Riccardo De Contardi about 2 years ago
- Status changed from Resolved to Closed