Last modified: 2013-03-14 16:35:33 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T11500, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9500 - mime type detection for auto upload causes fileinfo.so crash on finfo_open
mime type detection for auto upload causes fileinfo.so crash on finfo_open
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.9.x
PC FreeBSD
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-05 01:08 UTC by Jim Keller
Modified: 2013-03-14 16:35 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jim Keller 2007-04-05 01:08:04 UTC
this may very well be a bug in the fileinfo.so extension for PHP, but I wanted
to post it in here in the event that someone else comes across the problem when
using MediaWiki, and perhaps so that a flag can be added to workaround the bug. 
When trying to do file uploads with MediaWiki, Apache was returning an Internal
Server Error, and I found this in my logs: 

/usr/libexec/ld-elf.so.1: /usr/local/lib/php/20050922/fileinfo.so: Undefined
symbol "php_realpath"

To me, this looks like a fileinfo.so bug or a PHP bug, but I couldn't find
anything on PHP's bugzilla that looked relevant. Not wanting to go upsetting a
stable server by blindly upgrading PHP + extensions, I started digging through
the mediawiki code and traced the problem to the if block starting on line 487
in includes/MimeMagic.php. The if statement checks to see if finfo_open() and
finfo_file() are available, and uses them for Mime detection if they exist. This
was evaluating to true because my PHP installation *does* have these functions,
but there appears to be some kind of internal issue with the fileinfo library on
my server. I simply forced this if block to evaluate to false (by adding "&&
false" to the conditions) so that the block falls through to the next elseif,
which uses mime_content_type() instead. I suppose it might be reasonable to add
a flag $wgIgnoreFinfoFunctions to force MediaWiki to use mime_content_type()
instead in the presence of this issue. That is unless it's just a product of my
specific server set up (e.g. php version + fileinfo version + O/S = bug), in
which case I suppose it should still be noted, even if it doesn't warrant a new
configuration directive. 

phpinfo:
PHP Version 5.1.6
System 	4.11-STABLE FreeBSD 4.11-STABLE #0: Fri Jan i386
fileinfo support	enabled
Server API 	CGI/FastCGI
PHP API 	20041225
PHP Extension 	20050922
Zend Extension 	220051025
Comment 1 Brion Vibber 2007-04-05 14:11:16 UTC
Offhand it looks like you've got a bad library; perhaps a mix of compilations
with different options or similar.

Googling turns up at least two other instances of this error, with no response,
at least one other also on FreeBSD.
Comment 2 Andre Klapper 2013-03-14 16:35:33 UTC
Highly assuming that this was a PHP issue.
Also see
http://www.gossamer-threads.com/lists/wiki/mediawiki/147360
http://www.gossamer-threads.com/lists/wiki/mediawiki/146985

Closing as WORKSFORME, but in case this still happens please reopen and provide more info (MediaWiki and PHP version).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links