php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57560 finfo_file cannot open (No such file or directory)
Submitted: 2007-03-04 00:00 UTC Modified: 2012-07-28 22:13 UTC
From: nomadcanuck at yahoo dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.1 OS: Windows XP
Private report: No CVE-ID: None
 [2007-03-04 00:00 UTC] nomadcanuck at yahoo dot com
Description:
------------
Apache/2.2.4 (Win32) PHP/5.2.1
fileinfo support enabled

exif_read_data function returns "FILE.MimeType: image/jpeg" on same files.



Reproduce code:
---------------
<?php
  $finfo = finfo_open(FILEINFO_MIME, 'C:/wamp/php/extras/magic');
  foreach (glob("*") as $filename) {
    echo $filename . "<br />";
    echo finfo_file($finfo, $filename) . "<br />";
  }
  finfo_close($finfo);
?>


Expected result:
----------------
image/jpeg
image/jpeg
image/jpeg
image/jpeg


Actual result:
--------------
test1.JPG
cannot open `test1.JPG' (No such file or directory)
test2.JPG
cannot open `test2.JPG' (No such file or directory)
test3.jpg
cannot open `test3.jpg' (No such file or directory)
test4.jpg
cannot open `test4.jpg' (No such file or directory)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-31 11:00 UTC] nashbridges12 at hotmail dot com
I can confirm that bug. The solution is to use the full path to the file eg.  echo finfo_file($finfo, realpath($filename))
 [2012-07-28 22:13 UTC] felipe@php.net
-Status: Open +Status: Not a bug -Package: Fileinfo +Package: *General Issues
 [2012-07-28 22:13 UTC] felipe@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 16:01:30 2024 UTC