#97515filemtime() of FileSessionHandler.php should be silent
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:
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.
Reviews 2
History 810
-
Alexander Rotzsch commented 04/29/22, 10:59
-
Andreas Kienast changed Sprint Focus On Location Sprint 08/05/22, 09:44
-
Oliver Hader changed Sprint Focus
On Location Sprint11/03/22, 09:04 -
Benni Mack changed Sprint Focus Stabilization Sprint 06/06/23, 12:59
-
Łukasz Uznański commented 10/02/23, 15:55
Is muting
filemtimecall a preferred solution? -
Alexander Rotzsch commented 02/06/25, 07:15
The warning (and lots of BE logs) is still there in TYPO3 12 + 13.
-
Gerrit Code Review pushed patch set 1 for main to change 88769 status
NewUnder Review 03/26/25, 11:54 -
Gerrit Code Review pushed patch set 1 for 13.4 to change 88781 03/26/25, 20:32
-
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % 03/26/25, 20:35Applied in changeset commit:eb489dbdaa0571e56f1262b4dd65c8949e6dc488.
-
Benni Mack changed status
ResolvedClosed 12/02/25, 14:33
Correction: … so it might be a good idea to prepend it at other places, too.