#28907 [Opn]: ftp_chdir issues Warning when Failed to change directory. No error required.
| From: | mchizewski at yahoo dot com | Date: | Thu, 24 Jun 2004 15:07:03 +0000 |
| Subject: | #28907 [Opn]: ftp_chdir issues Warning when Failed to change directory. No error required. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61317@lists.php.net to get a copy of this message | ||
ID: 28907
User updated by: mchizewski at yahoo dot com
Reported By: mchizewski at yahoo dot com
Status: Open
Bug Type: FTP related
Operating System: Windows 2000 SP 3
PHP Version: 5.0.0RC3
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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