Bug #52466 [Opn->Csd]: PHP cannot see filenames with spaces
| From: | d dot reade at ReadesGroupServices dot com | Date: | Wed, 28 Jul 2010 08:40:28 +0000 |
| Subject: | Bug #52466 [Opn->Csd]: PHP cannot see filenames with spaces | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152868@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52466&edit=1
ID: 52466
User updated by: d dot reade at ReadesGroupServices dot com
Reported by: d dot reade at ReadesGroupServices dot com
Summary: PHP cannot see filenames with spaces
-Status: Open
+Status: Closed
Type: Bug
Package: Filesystem function related
Operating System: CentOS 5.5
PHP Version: 5.3.3
Block user comment: N
New Comment:
That's weird, it was doing it for me a second ago... and now it's not!!
Sorry to waste your time, but thanks anyway.
Previous Comments:
------------------------------------------------------------------------
[2010-07-28 10:33:47] degeberg@php.net
Works fine for me using latest SVN 5.3 build:
daniel@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
daniel@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"
}
------------------------------------------------------------------------
[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