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

 ID:                 52466
 Updated by:         degeb...@php.net
 Reported by:        d dot reade at ReadesGroupServices dot com
 Summary:            PHP cannot see filenames with spaces
 Status:             Open
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   CentOS 5.5
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

Works fine for me using latest SVN 5.3 build:



dan...@daniel-laptop:~/tmp$ ls -l

total 24

-rw-r--r-- 1 daniel daniel 0 2010-07-28 10:30 foo bar.txt

-rw-r--r-- 1 daniel daniel 0 2010-07-28 10:30 helloworld.txt

dan...@daniel-laptop:~/tmp$ php -r 'var_dump(scandir("."));'

array(4) {

  [0]=>

  string(1) "."

  [1]=>

  string(2) ".."

  [2]=>

  string(11) "foo bar.txt"

  [3]=>

  string(14) "helloworld.txt"

}


Previous Comments:
------------------------------------------------------------------------
[2010-07-28 10:27:35] d dot reade at ReadesGroupServices dot com

Description:
------------
Using the scandir() method to fetch a list of filenames in a folder.
Some filenames contain a space (via SSH this appears as "\ ", i.e.
"test\ file.txt"). However PHP sees this file as "test_file.txt". This
causes additional file operations such as file_exists() to return false.

Test script:
---------------
<?php

\\ path/to/folder/ contents:

\\ file.txt

\\ test\ file.txt



$scan = scandir('path/to/folder/');



foreach ($scan as $file)

{

    echo $file.'

';

}

?>

Expected result:
----------------
file.txt

test\ file.txt

Actual result:
--------------
file.txt

test_file.txt


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



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

Reply via email to