ID: 28907 Updated by: [EMAIL PROTECTED] Reported By: mchizewski at yahoo dot com -Status: Open +Status: Bogus Bug Type: FTP related Operating System: Windows 2000 SP 3 PHP Version: 5.0.0RC3 New Comment:
The warning message stays, I've updated the documentation to explicitly state that the warning message will be issued. is_dir() and is_file *do* work on ftp:// URLs in PHP5. if (is_dir('ftp://user:[EMAIL PROTECTED]/path/to/file')) { /* The directory exists */ } The is_dir() method opens a new connection for reach request so if you plan on doing multiple FS ops, then working via the ftp extension (using ftp_chdir() to check) is probably the best way to go. Previous Comments: ------------------------------------------------------------------------ [2004-06-24 17:07:00] mchizewski at yahoo dot com This is also what happens with the ftp_login function. "Returns TRUE on success or FALSE on failure." It should not give a warning message. ------------------------------------------------------------------------ [2004-06-24 15:05:50] mchizewski at yahoo dot com Also please note, if this is not how it should be, the PHP Manual needs to be updated. However, I would much rather see the warning message removed. Unless of course there is a ftp function simular to is_file or is_dir. Right now, I see ftp_chdir the best way of finding this out quicky. ------------------------------------------------------------------------ [2004-06-24 03:24:41] mchizewski at yahoo dot com Description: ------------ When ftp_chdir cannot change directory, it produces the following PHP warning. Warning: ftp_chdir()[http://www.php.net/manual/en/function.ftp-chdir]: Failed to change directory. in C:\Documents and Settings\(...)\ftp.php on line 137 If ftp_chdir cannot change the directory, it should do as the documentation says and just return false. "Returns TRUE on success or FALSE on failure." Reproduce code: --------------- // code as part of a ftp class function change_ftp_directory () { if ($this -> ftp_login === false) { return false; } $this -> change_ftp_directory = ftp_chdir ($this -> ftp_resource, $this -> ftp_path); if ($this -> change_ftp_directory === false) { return false; } return true; } Expected result: ---------------- It returns false if the change directory path is bad. No PHP error reported. Actual result: -------------- Warning: ftp_chdir()[http://www.php.net/manual/en/function.ftp-chdir]: Failed to change directory. in C:\Documents and Settings\(...)\ftp.php on line 137 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28907&edit=1