|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-10-24 19:47 UTC] messaged at messaged dot lv
Description:
------------
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@127.0.0.1/www');
→ false
[24] boris> is_dir('ftp://message:password@127.0.0.1/temporary_fixtures');
→ false
[25] boris> is_dir('ftp://message:password@127.0.0.1/');
→ true
[26] boris> is_dir('/Users/message/www');
→ true
Expected result:
----------------
[23] boris> is_dir('ftp://message:password@127.0.0.1/www');
→ true
Actual result:
--------------
[23] boris> is_dir('ftp://message:password@127.0.0.1/www');
→ false
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 07:00:01 2025 UTC |
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@127.0.0.1/[FTP's root]/www');Yes, that's likely a misuse. Try print_r(scandir('ftp://message:password@127.0.0.1/)) and you likely get roughly the same output as with ftp_nlist($ftp,'.')