Bug #63634
closedFAL update Metadata in LocalStorage not working because of buggy php
0%
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.
Updated by Stefan Klug almost 10 years ago
For anyone searching for a quick fix without patching typo3:
Adding
if(!defined(FILEINFO_MIME_TYPE)) define(FILEINFO_MIME_TYPE, 16);
to the top of typo3conf/LocalConfiguration.php is enough to fix this case
Updated by Alexander Opitz almost 10 years ago
Taking a look into the PHP documentation http://php.net/manual/en/fileinfo.constants.php
FILEINFO_MIME_TYPE (integer) Return the mime type. Available since PHP 5.3.0.
So this should be available since PHP 5.3.0.
@Stefan
You run "php -v" in console, is it possible that the webserver uses another version of php? There is also no issue report in the PHP bug database. So, can you look at first for the PHP version which is used by the webserver?
Updated by Stefan Klug almost 10 years ago
That's really strange. phpinfo() from within the typo3 install tool also gives PHP Version 5.3.29 . I checked the php sourcecode on github and I can't think of any way where FILEINFO_MIME is defined whilst FILEINFO_MIME_TYPE is not.
I am not the core admin of that server and don’t have access to the original sources and the build system so I can't dig deeper there.
The only thing I found was this: https://bugs.php.net/bug.php?id=60679
But that one also was closed some time ago.
You can close this bug and I'll treat it as a strange compiler/solar-winds issue. If more users have this problem they will find this...
Thanks a lot for your time.
Updated by Alexander Opitz almost 10 years ago
Ok, can you post the complete version string (if there stands more in the line) also it would be interesting what system/distribution and in which version are used (Debian/FreeBSD) if this information is available for you.
Updated by Christian Kuhn over 9 years ago
- Status changed from New to Closed
Alright. I'm closing this issue for now.
It will still be found if further people stumble upon it. It would be interesting which specific php version falls into this issue - we may come up with a fix then if we know more details.