Bug #64327 [NEW]: is_file, file_exists, is_readable fail on special characters
| From: | ashwini at majestik dot net | Date: | Thu, 28 Feb 2013 20:32:25 +0000 |
| Subject: | Bug #64327 [NEW]: is_file, file_exists, is_readable fail on special characters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-177480@lists.php.net to get a copy of this message | ||
From: ashwini at majestik dot net
Operating system: Windows Server 2003
PHP version: Irrelevant
Package: Filesystem function related
Bug Type: Bug
Bug description:is_file, file_exists, is_readable fail on special characters
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 bug report at https://bugs.php.net/bug.php?id=64327&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64327&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64327&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64327&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64327&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64327&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64327&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64327&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64327&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64327&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64327&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64327&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64327&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64327&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64327&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64327&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64327&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64327&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64327&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64327&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64327&r=mysqlcfg