Bug #47969

Call to undefined function mime_content_type()

Added by Oliver Hader over 6 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Frontend
Target version:
Start date:
2013-05-06
Due date:
% Done:

100%

TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
Yes
Sprint Focus:

Description

Call to undefined function mime_content_type() on fetching the mime type of the favicon.
I'm still investigating the PHP versions and environment. However it looks like a superfluous regression from #46126


Related issues

Related to TYPO3 Core - Task #46126: Make mimetype-detection possible without finfo_file (pre-PHP-5.3, no pecl-fileinfo) Closed 2013-03-08

Associated revisions

Revision e0603861 (diff)
Added by Christian Kuhn over 6 years ago

[BUGFIX] Call to undefined function mime_content_type()

With PHP 5.2, it might happen that mime_content_type is not
available. This was introduced by #46126 and is now better
sanitized by the patch again.

Change-Id: I4145461d46fc12d0569bfffc0ad4750f67aeed2c
Resolves: #47969
Related: #46126
Releases: 4.5
Reviewed-on: https://review.typo3.org/20557
Reviewed-by: Steffen Ritter
Reviewed-by: Jigal van Hemert
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

History

#1 Updated by Borries Jensen over 6 years ago

After an update from 4.5.25 to 4.5.26 the same problem exists.

PHP version used on one dev/test server is 5.2.5.

#2 Updated by Oliver Hader over 6 years ago

  • Priority changed from Should have to Must have

#3 Updated by Oliver Hader over 6 years ago

Borries Jensen wrote:

After an update from 4.5.25 to 4.5.26 the same problem.

PHP Version used on one Dev/Test-Server is 5.2.5

Thanks for your response. What distribution/operating system and which version are you using?
Is it a custom compiled PHP version or a standard package of PHP that is being used?

#4 Updated by Borries Jensen over 6 years ago

Ok, detailed info of the dev machine follows:

SUSE Linux Enterprise Server 10 (i586)
VERSION = 10
PATCHLEVEL = 2

PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli)
This PHP version is/was the one from SLES repository (no custom compilation done by us).

#5 Updated by Oliver Hader over 6 years ago

  • Status changed from New to Accepted

#6 Updated by Markus Klein over 6 years ago

What's going on here??
mime_content_type is available since PHP 4.3, so the method should be present in 5.2.5.

#7 Updated by Borries Jensen over 6 years ago

Hm, am i right that to use the function mime_content_type() the server needs not only the apache module "mod_mime" but also "mod_mime_magic" ?

I just checked the server which causes the mentioned error.
Only "mod_mime" is active there.
Maybe that's causing the error.

#8 Updated by Thorsten Kahler over 6 years ago

According to http://php.net/manual/en/fileinfo.installation.php the Fileinfo extension requires a (patched) magic_open library (libmagic) in PHP versions < 5.3.0. It is provided and enabled by default, but still not part of the PHP core.
As of PHP 5.3.0 (?) mime_content_type() is deprecated and replaced by the finfo class.

All in all: these functions/classes seem to be moving ground and might require a more sophisticated approach. I think a wrapper method to abstract from the different implementations should help.

#9 Updated by Markus Klein over 6 years ago

There's another requirement that might play a role: required library "magic_open"
http://at1.php.net/manual/en/fileinfo.requirements.php

#10 Updated by Borries Jensen over 6 years ago

Only enabling "mod_mime_magic" did not solve the problem.
Just tried it on the mentioned machine.

#11 Updated by Oliver Hader over 6 years ago

It's a regression thus needs to be fixed. Not having a mime-type for the favicon does not harm (as it has been before), but running into a fatal error on each frontend request does. No need to discuss that further - it's a bug.

#12 Updated by Markus Klein over 6 years ago

I guess a simple function_exists() call to check the existence is fine?

#13 Updated by Gerrit Code Review over 6 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at https://review.typo3.org/20557

#14 Updated by Christian Kuhn over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#15 Updated by Tomas Norre Mikkelsen over 6 years ago

Hi,

Will these result in a new TYPO3 release? Or just included in next release? I have a lot of solutions not updated cause of the issue.

#16 Updated by Markus Klein over 6 years ago

@Tomas: It will definitely be included in the next bugfix release. In the meanwhile you can apply the patch manually to your installations.

#17 Updated by Tomas Norre Mikkelsen over 6 years ago

@Markus: Do you know when next release will be? Have about 15 servers which need to be patched. And normally I/we don't allow "manipulated" sources.

#18 Updated by Ernesto Baschny about 6 years ago

  • Is Regression set to Yes

#19 Updated by Ernesto Baschny about 6 years ago

  • Category changed from 1394 to Frontend

#20 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF