php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72667 opendir() with ftp:// attempts to open data stream for non-existent directories
Submitted: 2016-07-25 10:21 UTC Modified: 2016-07-25 11:38 UTC
From: vhu at iki dot fi Assigned:
Status: Closed Package: Directory function related
PHP Version: 7.1Git-2016-07-25 (Git) OS: all
Private report: No CVE-ID:
 [2016-07-25 10:21 UTC] vhu at iki dot fi
Description:
------------
opendir() attempts to open FTP data stream for non-existent directories when used with ftp:// wrapper.

Test script:
---------------
var_dump(opendir("ftp://example.com/nonexistent"));
var_dump(opendir("ftp://example.com/"));


Expected result:
----------------
Warning: opendir(ftp://example.com/nonexistent): failed to open dir: FTP server reports 250 The system cannot find the file specified. 
 in test.php on line 2
bool(false)
resource(8) of type (stream)

Actual result:
--------------
 PHP Warning:  opendir(): connect() failed: Connection timed out in test.php on line 2
PHP Warning:  opendir(ftp://example.com/nonexistent): failed to open dir: FTP server reports 200 Type set to A.
 in test.php on line 2
bool(false)
resource(9) of type (stream)

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-25 11:38 UTC] vhu at iki dot fi
-Summary: opendir() attempts to open FTP data stream for non-existent directories +Summary: opendir() with ftp:// attempts to open data stream for non-existent directories
 [2016-07-25 11:38 UTC] vhu at iki dot fi
Clarified summary.
 [2016-07-27 14:01 UTC] nikic@php.net
Automatic comment on behalf of vhu@iki.fi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cce457c68c3a15efafea3a30560c54f74f3f5ee1
Log: Fix bug #72667
 [2016-07-27 14:01 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2016-10-17 10:10 UTC] bwoebi@php.net
Automatic comment on behalf of vhu@iki.fi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cce457c68c3a15efafea3a30560c54f74f3f5ee1
Log: Fix bug #72667
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Jul 25 16:01:42 2017 UTC