Edit report at http://bugs.php.net/bug.php?id=36423&edit=1
ID: 36423 Comment by: moritz at pflanzer dot eu Reported by: bholbrook at servillian dot com Summary: Suggestion for FTP functions Status: Wont fix Type: Feature/Change Request Package: Feature/Change Request Operating System: Red Hat v? PHP Version: 4.4.2 New Comment: The suggested method to emulate ftp_is_file() does not work correctly! Imagine you check a path linking to an directory with only one file in it then the function would return true although the path belongs to an directory. Previous Comments: ------------------------------------------------------------------------ [2006-02-17 18:08:17] bj...@php.net These can easily be emulated in userspace as is. function ftp_file_exists($ftp, $file) { $tmp = ftp_nlist($ftp, $file); return is_array($tmp) ? true : false; } function ftp_is_dir($ftp, $dir) { return @ftp_chdir($ftp, $dir. "/.."); } function ftp_is_file($ftp, $file) { $tmp = ftp_nlist($ftp, $file); return is_array($tmp) && count($tmp) == 1 ? true : false; } If this were to be implemented at extension level the code would probably do the exact same thing. Can't see any reason to implement it. ------------------------------------------------------------------------ [2006-02-16 22:07:07] bholbrook at servillian dot com Description: ------------ Suggestion for additional FTP functions ftp_is_dir(), ftp_file_exists(), ftp_is_file(). Currently can be accomplished by if(!ftp_chdir()), if(!ftp_mdtm()) but has some effects on true that can cause additional coding. Sorry if this is the wrong place for it (please let me know where to send these so that I dont repeat this mistake) Thanks. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=36423&edit=1