|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67009 ftp:// stream wrapper doesn't work with Microsoft FTP Service
Submitted: 2014-04-03 11:55 UTC Modified: 2021-02-17 15:24 UTC
Avg. Score:3.8 ± 0.8
Reproduced:2 of 4 (50.0%)
Same Version:2 (100.0%)
Same OS:0 (0.0%)
From: vosa at binaryparadise dot com Assigned: cmb (profile)
Status: Feedback Package: Streams related
PHP Version: Irrelevant OS: debian, solaris
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-04-03 11:55 UTC] vosa at binaryparadise dot com
From manual page:
I have some troubles with getting list of files from Microsoft's FTP server (Microsoft FTP Service) using ftp:// stream wrapper. There is difference in output, when trailing slash is used or not. I didn't see this problem, when other FTP server (i.e. pure-ftpd) is used.

I tried scan directory with scandir() function, but I get same output using readdir(). See test script.

There is a big problem to get list of files recursively. Directories with backslashes are incorrect and testing functions (like file_exists, is_dir, is_file) doesn't consider those paths correct.

This problem occured even with DirectoryIterator with or without trailing slash.

Test script:
# ftp folder structure:
# /test_folder
#   dir1
#     file1
#   dir2
#     file2

$path = 'ftp://user:password@';

print "with trailing slash:\n";
foreach(scandir($path) as $file) {
    print "$file\n";

print "without trailing slash:\n"
$path = substr($path, 0, -1);
foreach(scandir($path) as $file) {
    print "$file\n";

Expected result:
with trailing slash:
without trailing slash:

Actual result:
with trailing slash:
without trailing slash:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-17 15:24 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-02-17 15:24 UTC]
I cannot reproduce this with PHP-7.4.  Is this still an issue for
you with any of the actively supported PHP versions[1]?

[1] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Feb 24 21:01:24 2021 UTC