#39458 [Asn]: ftp_nlist returns false on empty directories  
Author Message
php-bugs





PostPosted: 2006-11-10 22:21:48 Top

php-dev, #39458 [Asn]: ftp_nlist returns false on empty directories ID: 39458
User updated by: brain at eucoders dot com
Reported By: brain at eucoders dot com
Status: Assigned
Bug Type: FTP related
Operating System: Rehat Linux
PHP Version: 4.4.4
Assigned To: sesser
New Comment:

The problem is that the developer cannot use this ftp_rawlist in case
the directory do not exist. In that case, ftp_nlist will return false
(unreliable result) and ftp_rawlist return Array() which is again
unreliable.

The best fix would be that ftp_nlist return false when the directory
does not exist, and Array() when directory is empty.


Previous Comments:
------------------------------------------------------------------------

[2006-11-10 12:07:43] brain at eucoders dot com

It seems that ftp_rawlist has the corrected behaviour and it is
returning an empty array.

------------------------------------------------------------------------

[2006-11-10 12:06:11] brain at eucoders dot com

ftp_nlist returns false on empty directories instead of empty array

------------------------------------------------------------------------

[2006-11-10 12:04:54] brain at eucoders dot com

Description:
------------
ftp_nlist returns false on empty directories



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39458&edit=1
 
php-bugs





PostPosted: 2006-11-10 22:20:00 Top

php-dev >> #39458 [Asn]: ftp_nlist returns false on empty directories ID: 39458
User updated by: brain at eucoders dot com
Reported By: brain at eucoders dot com
Status: Assigned
Bug Type: FTP related
Operating System: Rehat Linux
PHP Version: 4.4.4
Assigned To: sesser
New Comment:

The problem is that the developer cannot use this ftp_rawlist in case
the directory do not exist. In that case, ftp_nlist will return false
(unreliable result) and ftp_rawlist return Array() which is again
unreliable.

The best fix would be that ftp_nlist return false when the directory
does not exist, and Array() when directory is empty.


Previous Comments:
------------------------------------------------------------------------

[2006-11-10 12:07:43] brain at eucoders dot com

It seems that ftp_rawlist has the corrected behaviour and it is
returning an empty array.

------------------------------------------------------------------------

[2006-11-10 12:06:11] brain at eucoders dot com

ftp_nlist returns false on empty directories instead of empty array

------------------------------------------------------------------------

[2006-11-10 12:04:54] brain at eucoders dot com

Description:
------------
ftp_nlist returns false on empty directories



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39458&edit=1
 
php-bugs





PostPosted: 2006-11-11 0:18:00 Top

php-dev >> #39458 [Asn]: ftp_nlist returns false on empty directories ID: 39458
User updated by: brain at eucoders dot com
Reported By: brain at eucoders dot com
Status: Assigned
Bug Type: FTP related
Operating System: Rehat Linux
PHP Version: 4.4.4
Assigned To: sesser
New Comment:

It appears that this problem appears on php 4.4.4 and also 4.3.2
version. Other versions should contain the same problem.


Previous Comments:
------------------------------------------------------------------------

[2006-11-10 14:20:22] brain at eucoders dot com

The problem is that the developer cannot use this ftp_rawlist in case
the directory do not exist. In that case, ftp_nlist will return false
(unreliable result) and ftp_rawlist return Array() which is again
unreliable.

The best fix would be that ftp_nlist return false when the directory
does not exist, and Array() when directory is empty.

------------------------------------------------------------------------

[2006-11-10 12:07:43] brain at eucoders dot com

It seems that ftp_rawlist has the corrected behaviour and it is
returning an empty array.

------------------------------------------------------------------------

[2006-11-10 12:06:11] brain at eucoders dot com

ftp_nlist returns false on empty directories instead of empty array

------------------------------------------------------------------------

[2006-11-10 12:04:54] brain at eucoders dot com

Description:
------------
ftp_nlist returns false on empty directories



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39458&edit=1
 
 
php-bugs





PostPosted: 2006-11-11 0:19:00 Top

php-dev >> #39458 [Asn]: ftp_nlist returns false on empty directories ID: 39458
User updated by: brain at eucoders dot com
Reported By: brain at eucoders dot com
Status: Assigned
Bug Type: FTP related
Operating System: Rehat Linux
PHP Version: 4.4.4
Assigned To: sesser
New Comment:

It appears that this problem appears on php 4.4.4 and also 4.3.2
version. Other versions should contain the same problem.


Previous Comments:
------------------------------------------------------------------------

[2006-11-10 14:20:22] brain at eucoders dot com

The problem is that the developer cannot use this ftp_rawlist in case
the directory do not exist. In that case, ftp_nlist will return false
(unreliable result) and ftp_rawlist return Array() which is again
unreliable.

The best fix would be that ftp_nlist return false when the directory
does not exist, and Array() when directory is empty.

------------------------------------------------------------------------

[2006-11-10 12:07:43] brain at eucoders dot com

It seems that ftp_rawlist has the corrected behaviour and it is
returning an empty array.

------------------------------------------------------------------------

[2006-11-10 12:06:11] brain at eucoders dot com

ftp_nlist returns false on empty directories instead of empty array

------------------------------------------------------------------------

[2006-11-10 12:04:54] brain at eucoders dot com

Description:
------------
ftp_nlist returns false on empty directories



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39458&edit=1
 
 
php-bugs





PostPosted: 2007-1-4 2:24:00 Top

php-dev >> #39458 [Asn]: ftp_nlist returns false on empty directories ID: 39458
User updated by: brain at eucoders dot com
Reported By: brain at eucoders dot com
Status: Assigned
Bug Type: FTP related
Operating System: Rehat Linux
PHP Version: 4.4.5-dev
Assigned To: nlopess
New Comment:

Ok, after testing and testing and testing I got a nasty conclusion...

After testing:
http://www.phpclasses.org/browse/package/3174.html
http://www.phpclasses.org/browse/package/2137.html
http://www.phpclasses.org/browse/package/1244.html
which are simple clases to handle FTP without builtin functions I got
the same result which is "false" instead of "array()".

That gave me the conclusion that it can be another bug in my ProFTP
server 1.2.9 and I tried the same scripts for a different ftp server
and worked fine.

I think I will try to update ProFTP as well, and check again and post a
bug on their site.

Thanx.


Previous Comments:
------------------------------------------------------------------------

[2007-01-03 18:10:35] email***@***.com

I didn't merge the patches to PHP 4..

------------------------------------------------------------------------

[2007-01-03 17:10:07] brain at eucoders dot com

The previous sequence is returning false even though the directory
exists and have 777 permissions.

------------------------------------------------------------------------

[2007-01-03 17:07:34] brain at eucoders dot com

The sequence of the code is:

ftpconnect();
echo "'";
$a=ftp_nlist($ftp_id, '/httpdocs/_site/s/5/0/3/t');
if($a===false) echo 'false';
else print_r($a);
echo "'";
ftpclose();

(ftpconnect and ftpclose are my defined functions to connect to ftp
server)

------------------------------------------------------------------------

[2007-01-03 17:06:10] brain at eucoders dot com

I installed:

php4 (tar.bz2) (4.3M) php4 (tar.gz) (5.3M)
Built On: Jan 03, 2007 15:30 GMT

but the problem still appear.

------------------------------------------------------------------------

[2006-12-01 16:38:43] email***@***.com

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/39458

--
Edit this bug report at http://bugs.php.net/?id=39458&edit=1
 
 
php-bugs





PostPosted: 2007-1-4 2:25:00 Top

php-dev >> #39458 [Asn]: ftp_nlist returns false on empty directories ID: 39458
User updated by: brain at eucoders dot com
Reported By: brain at eucoders dot com
Status: Assigned
Bug Type: FTP related
Operating System: Rehat Linux
PHP Version: 4.4.5-dev
Assigned To: nlopess
New Comment:

Ok, after testing and testing and testing I got a nasty conclusion...

After testing:
http://www.phpclasses.org/browse/package/3174.html
http://www.phpclasses.org/browse/package/2137.html
http://www.phpclasses.org/browse/package/1244.html
which are simple clases to handle FTP without builtin functions I got
the same result which is "false" instead of "array()".

That gave me the conclusion that it can be another bug in my ProFTP
server 1.2.9 and I tried the same scripts for a different ftp server
and worked fine.

I think I will try to update ProFTP as well, and check again and post a
bug on their site.

Thanx.


Previous Comments:
------------------------------------------------------------------------

[2007-01-03 18:10:35] email***@***.com

I didn't merge the patches to PHP 4..

------------------------------------------------------------------------

[2007-01-03 17:10:07] brain at eucoders dot com

The previous sequence is returning false even though the directory
exists and have 777 permissions.

------------------------------------------------------------------------

[2007-01-03 17:07:34] brain at eucoders dot com

The sequence of the code is:

ftpconnect();
echo "'";
$a=ftp_nlist($ftp_id, '/httpdocs/_site/s/5/0/3/t');
if($a===false) echo 'false';
else print_r($a);
echo "'";
ftpclose();

(ftpconnect and ftpclose are my defined functions to connect to ftp
server)

------------------------------------------------------------------------

[2007-01-03 17:06:10] brain at eucoders dot com

I installed:

php4 (tar.bz2) (4.3M) php4 (tar.gz) (5.3M)
Built On: Jan 03, 2007 15:30 GMT

but the problem still appear.

------------------------------------------------------------------------

[2006-12-01 16:38:43] email***@***.com

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/39458

--
Edit this bug report at http://bugs.php.net/?id=39458&edit=1