|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65963 is_dir wrong behaviour when used with ftp on localhost
Submitted: 2013-10-24 19:47 UTC Modified: 2021-02-28 04:22 UTC
Avg. Score:4.0 ± 0.8
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: messaged at messaged dot lv Assigned: cmb (profile)
Status: No Feedback Package: FTP related
PHP Version: 5.5.5 OS: Mac OS X
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: messaged at messaged dot lv
New email:
PHP Version: OS:


 [2013-10-24 19:47 UTC] messaged at messaged dot lv
Wrong behaviour when i use is_dir() on localhost. Works as expected on external php.

Test script:
[19] boris> $ftp = ftp_connect('localhost');
 → resource(39) of type (FTP Buffer)

[20] boris> ftp_login($ftp, 'message', 'password');
 → true

[22] boris> ftp_nlist($ftp,'.');
 → array(
  42 => 'Applications',
  43 => 'Desktop',
  44 => 'Documents',
  45 => 'Downloads',
  46 => 'Dropbox',
  47 => 'fixtures',
  49 => 'Library',
  52 => 'Movies',
  53 => 'Music',
  56 => 'Pictures',
  57 => 'Public',
  58 => 'springsource',
  59 => 'temporary_fixtures',
  61 => 'www'

[23] boris> is_dir('ftp://message:password@');
 → false

[24] boris> is_dir('ftp://message:password@');
 → false

[25] boris> is_dir('ftp://message:password@');
 → true

[26] boris> is_dir('/Users/message/www');
 → true

Expected result:
[23] boris> is_dir('ftp://message:password@');
 → true

Actual result:
[23] boris> is_dir('ftp://message:password@');
 → false


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-16 20:37 UTC] tomas dot brastavicius at quantum dot lt
You should pass a path relative to a root directory but not to a CWD of the FTP server.
Try to configure your local FTP's server in a way to chroot user's directory or try is_dir('ftp://message:password@[FTP's root]/www');
 [2021-02-18 13:25 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-02-18 13:25 UTC]
Yes, that's likely a misuse.  Try


and you likely get roughly the same output as with

 [2021-02-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Aug 16 01:05:45 2022 UTC