[wp-trac] [WordPress Trac] #30815: WP_Filesystem_FTPext::exists() returns false if directory exists but is empty
WordPress Trac
noreply at wordpress.org
Mon Dec 22 10:01:54 UTC 2014
#30815: WP_Filesystem_FTPext::exists() returns false if directory exists but is
empty
----------------------------+-----------------------------
Reporter: Unyson | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Filesystem API | Version: 4.1
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
{{{
/**
* Check if a file or directory exists.
*
* @since 2.5.0
* @abstract
* @param string $file Path to file/directory.
* @return bool Whether $file exists or not.
*/
public function exists($file) {
$list = @ftp_nlist($this->link, $file);
return !empty($list); //empty list = no file, so invert.
}
}}}
This method doesn't take in consideration that directory may exist but is
empty.
The `WP_Filesystem_FTPext::is_dir()` method works correct (returns
`true`). But the `exists()` method must be fixed, I think it's a major
bug.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30815>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list