php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70903 scandir wrongly interprets the Turkish "ı" character
Submitted: 2015-11-12 23:30 UTC Modified: 2016-08-08 09:54 UTC
Votes:6
Avg. Score:4.5 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:5 (100.0%)
From: eparlakay at hotmail dot com Assigned: ab (profile)
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 7.0.0RC7 OS: Windows 7 Enterprise
Private report: No CVE-ID: None
 [2015-11-12 23:30 UTC] eparlakay at hotmail dot com
Description:
------------
Scandir function wrongly interprets the Turkish "ı" (i without dot) character. It interprets the "ı" as "i".

For the test script, assume there are two directories in a folder:

c:\Music\
 |
 | Aslı
 | Asli



Test script:
---------------
<?php
	$FILES = scandir("C:\\Music\\");
	
	foreach($FILES as $k=>$v)
	{
		if(!mkdir("c:\\TEST\\".$v))
		{
			echo "ERROR for ".$v."\n";
		}
                else
		{
			echo "Folder is created\n";
		}
	}
?>

Expected result:
----------------
Folder is created
Folder is created

Actual result:
--------------
Folder is created

Warning: mkdir(): File exists in C:\testingScandir.php on line 6
ERROR for Sila: 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-12 23:33 UTC] eparlakay at hotmail dot com
Correcting a typo error in actual result:

Folder is created

Warning: mkdir(): File exists in C:\testingScandir.php on line 6
ERROR for Asli:
 [2015-12-19 01:45 UTC] ajf@php.net
I suspect this is an issue with Windows's filesystem case handling and not PHP itself.

Could you try the Command Prompt and see how it responds here?
 [2016-06-13 22:53 UTC] cmb@php.net
Apparently, the issue is already with scandir(). var_dump'ing its
result (PHP 7.0.7, German Windows 10):

    array(4) {
      [0]=>
      string(1) "."
      [1]=>
      string(2) ".."
      [2]=>
      string(4) "Asli"
      [3]=>
      string(4) "Asli"
    }

While dir(1) reports:

    14.06.2016  00:33    <DIR>          .
    14.06.2016  00:33    <DIR>          ..
    14.06.2016  00:31    <DIR>          Asli
    14.06.2016  00:31    <DIR>          Aslı
 [2016-08-08 09:54 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2016-08-08 09:54 UTC] ab@php.net
Fixed in PHP 7.1

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 11:01:28 2024 UTC