Project

General

Profile

Actions

Bug #97515

open

filemtime() of FileSessionHandler.php should be silent

Added by Alexander Rotzsch over 2 years ago. Updated about 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-04-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:
Stabilization Sprint

Description

Hi,

I encountered several errors like this after our own crawler runs through all pages of our intranet:

Core: Error handler (FE): PHP Warning: filemtime(): stat failed for /var/www/intranet/var/session/d7d439161737edaa72aa09938771f17c4fd208af/hash_6541a8ee794d962b4d07f99a08ba3992 in /var/www/intranet/public/typo3/sysext/install/Classes/Service/Session/FileSessionHandler.php line 184

The causing line is here:

https://github.com/TYPO3/typo3/blob/bbc8676ba09c058d7b6f6d595e5931333f48b993/typo3/sysext/install/Classes/Service/Session/FileSessionHandler.php#L184

What I found out after a lot of testing: The method reads the session hash directory and does some time comparison. Unfortunately when a lot of crawls take place in very short periods, filemtime() tries to read a hash file that is already deleted by another call of the gc(int $maxLifeTime) method.

Solution: @filemtime() instead of filemtime()

In the core, there are several places where an "@" is prepended to filemtime(), so it might be a good idea to prepend it there too. Same of course goes for other file methods that are similar.

https://www.php.net/manual/de/function.filemtime.php

Actions

Also available in: Atom PDF