Issue Bug Closed

#63634FAL update Metadata in LocalStorage not working because of buggy php

Stefan Klug 12/06/14, 20:01 updated 02/24/15, 17:33

Description

Hi,

I had the same issue described in #46020, namely that all my images where missing width/height information in sys_file.
All the mentioned fixes didn’t really seem to help.
Finally it turned out, that the php version on the server is buggy. “php -v” says it is 5.3.29 (I know that’s quite old, but it i officially supported by Typo3 6.2)

The problematic code is in TYPO3\CMS\Core\Resource\Driver\LocalDriver in getMimeTypeOfFile():

$fileInfo = new \finfo();
return $fileInfo->file($absoluteFilePath, FILEINFO_MIME_TYPE);

FILEINFO_MIME_TYPE is not defined in this php version (per php docs it should be defined for php > 5.3)

Changing the code to

if(!defined(FILEINFO_MIME_TYPE)) define(FILEINFO_MIME_TYPE, 16);
$fileInfo = new \finfo();
return $fileInfo->file($absoluteFilePath, FILEINFO_MIME_TYPE);

solved the problem. I don’t know if FILEINFO_MIME_TYPE == 16 is true for every php version, so maybe we should fallback to using FILEINFO_MIME which is available.

After UPDATE sys_file SET missing=1 and resheduling the IndexUpdater everything is fine.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.