I came across an unusual error condition where the following error message
was output:
Warning: finfo_open() [function.finfo-open]: Failed to load magic database
at '/etc/magic'. in /htdocs/public/www/wp-
content/themes/starmagazine/scripts/timthumb.php on line 373
And as a result the image resize operation failed (headers already output).
I'm guessing this occurs where the finfo php extension is not configured or
installed correctly on the server, I fixed the code by adding some simple
error checking for finfo_open(), please see following diff code:
373,375c373,376
< $finfo = finfo_open(FILEINFO_MIME);
< $mime_type = finfo_file($finfo, $file);
< finfo_close($finfo);
---
> if ($finfo = @finfo_open(FILEINFO_MIME)) {
> $mime_type = finfo_file($finfo, $file);
> finfo_close($finfo);
> }
Would appreciate if you could include this patch in your svn trunk code.
Thanks!
Original issue reported on code.google.com by pieter.b...@gmail.com on 11 Nov 2009 at 12:54
Original issue reported on code.google.com by
pieter.b...@gmail.com
on 11 Nov 2009 at 12:54