#28907 [Opn->Bgs]: ftp_chdir issues Warning when Failed to change directory. No error required.

2004-06-24 Thread pollita
 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 documentation for both functions was updated, the changes take time
(often a week or more) to reach the website.

The ftp functions are NOT "required if you want to login to the ftp
server", they're just an alternate API.  is_dir() *DOES* work for ftp
urls with or without login details.  The is no need for an ftp_is_dir()
as it would duplicate the functionality of ftp_chdir().




Previous Comments:


[2004-06-25 01:44:33] mchizewski at yahoo dot com

If you are going to keep the warning message, please update the
documentation for ftp_login as well.

As you said, the is_dir will work if you are NOT using the ftp
functions. My understanding is that the ftp functions are required if
you need to login to an ftp server. There is no way to remove the
warning message?  It really seems wrong to have an error when it gives
you feedback true/false.

Is there any way to get an ftp is_dir function?

I do see putting @ in front of the function does suppress the error
message.

Thank you for your help!



[2004-06-24 18:22:06] [EMAIL PROTECTED]

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.



[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


#28907 [Opn->Bgs]: ftp_chdir issues Warning when Failed to change directory. No error required.

2004-06-24 Thread pollita
 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