Edit report at https://bugs.php.net/bug.php?id=64327&edit=1

 ID:                 64327
 Updated by:         a...@php.net
 Reported by:        ashwini at majestik dot net
 Summary:            is_file, file_exists, is_readable fail on special
                     characters
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Windows Server 2003
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Ok, so even not tested as your description delivers the solution. If the php 
file 
is utf8 encoded, the special char is represented with at least two bytes. If 
the 
real filename happens to use a single byte charset like cp1252, here you are. 
That 
doesn't mean you cannot use utf8 encoded sources, just care you always convert 
the 
filename to the right charset.


Previous Comments:
------------------------------------------------------------------------
[2013-02-28 20:32:25] ashwini at majestik dot net

Description:
------------
---
>From manual page: 
>http://www.php.net/function.is-file#refsect1-function.is-file-description
---
The is_file, file_exists and is_readable functions fail in Windows even if the 
file actually does exist, if the file name contains a special character. This 
happens because of the encoding of the .php file itself that executes the 
is_file function, if the .php file is encoded with UTF-8 then the above 
commands incorrectly fail.

If instead the .php file is encoded with "Western (Windows 1252)" then the file 
with the special character is found and is_file/file_exists/etc return 
correctly.

Tested under IIS 6 w/ PHP 5.2.4 on Windows Server 2003.

Test script:
---------------
<?
$my_picture="photos/fullsize/Djañgo.jpg";

if (is_file($my_picture)) { 
      echo "picture found!";
    } else { 
      echo "picture NOT found! $my_picture";
    }
?>



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64327&edit=1

Reply via email to