php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25296 error on ftp_nlist
Submitted: 2003-08-28 09:53 UTC Modified: 2003-09-02 13:33 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ates at isikun dot edu dot tr Assigned: pollita (profile)
Status: Wont fix Package: FTP related
PHP Version: 4.3.4-dev OS: win xp
Private report: No CVE-ID: None
 [2003-08-28 09:53 UTC] ates at isikun dot edu dot tr
Description:
------------
when i use $array=ftp_nlist(exact file name) // for example ftp_nlist(/http/fopen.php) it returns /http/fopen.php/fopen.php as 1st element of array so it must return /http/fopen.php .. 



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-28 10:06 UTC] pollita@php.net
Cannot reproduce.

Based on the description you provided I get the results which are expected from the documentation of ftp_nlist().

Please provide a simple and COMPLETE script which reproduces this error.  Obviously nooone expects you to give out a password to your own server, but you could try to reproduce this on a public ftp server.
 [2003-08-28 10:44 UTC] ates at isikun dot edu dot tr
look at url = http://webgroup.isikun.edu.tr/arge/ftp/ftp_connect.php
and the basic code to show you the error : 
(file is /tosun.txt) 
//here code starts
$ftp_server2 = "webgroup.isikun.edu.tr";
$ftp_user_name = "ates";
$ftp_user_pass = "*****";
$conn = ftp_connect($ftp_server2,5000);
ftp_login($conn, $ftp_user_name, $ftp_user_pass);
$nlist = (ftp_nlist($conn, "/tosun.txt"));
$rawlist = ftp_rawlist($conn, "/tosun.txt");
echo "nlist=>";
print_r($nlist); 
echo "<br>rawlist=>";
print_r($rawlist); 
ftp_close($conn);
 [2003-09-01 06:42 UTC] ates at isikun dot edu dot tr
same problem continues

look at url = http://webgroup.isikun.edu.tr/arge/ftp/ftp_connect.php
 [2003-09-01 21:51 UTC] sniper@php.net
See bug #25347
 [2003-09-02 03:02 UTC] ates at isikun dot edu dot tr
there is nothing about permissions, rawlist returns "tosun.txt" but nlist return "tosun.txt/tosun.txt "
if you nlist to files name it returns wrong think..
 [2003-09-02 10:02 UTC] pollita@php.net
Agreed, this isn't a duplicate of that other bug.

IIS returns \foo.txt properly, but somewhere along the line, PHP turns that into /foo.txt/foo.txt.

I'll take assignment.
 [2003-09-02 13:33 UTC] pollita@php.net
Correction:
  When I "reproduced" this bug, I was talking to IIS's FTP service directly using the "LIST" command (equivalent of ftp_rawlist) which does return correct data.  However, using the "NLST" command (equivalent of ftp_nlist) the data returned by IIS is "/http/fopen.php\fopen.php" which is precisely what PHP turns around and provides back.  This makes it Not-A-PHP-Bug, but rather a MS problem.

  That said I don't want to leave you in the lurch, so here's a workaround:

function IISisBROKEN_ftp_nlist($res, $dir) {
  if (ftp_size($res, $dir) >= 0) {
    return $dir;
  }

  return ftp_nlist($res, $dir);
}

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC