|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-04-14 22:02 UTC] predecess at hotmail dot com
Description:
------------
ftp_nlist does not work anymore, nor does ftp_rawlist.
Code that used ftp_nlist worked fine on PHP 4.3.9 and simply copying the code to a server running PHP 5.0.3 breaks it.
The /tmp directory's mode/permissions is set to 777
Reproduce code:
---------------
<?php
// Get FTP file list
$ftpconn = ftp_connect('ftp.example.com');
if ($ftpconn) {
if (ftp_login($ftpconn, 'username', 'password')) {
$path = '/this/same/task/works/fine/with/a/url/wrapper/';
$files = ftp_nlist($ftpconn, $path);
foreach ($files AS $filelist) {
echo $filelist.'<br>';
}
}
}
?>
Expected result:
----------------
this/same/task/works/fine/with/a/url/wrapper/file1.txt
this/same/task/works/fine/with/a/url/wrapper/file2.txt
this/same/task/works/fine/with/a/url/wrapper/file3.txt
this/same/task/works/fine/with/a/url/wrapper/file4.txt
Actual result:
--------------
Warning: Invalid argument supplied for foreach() in /documentroot_path/ftpBUG.php on line 9
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 04:00:01 2025 UTC |
This works fine for me (tm): <?php // Get FTP file list $ftpconn = ftp_connect('ftp.funet.fi'); if ($ftpconn) { if (ftp_login($ftpconn, 'username', 'password')) { $path = '/pub/Linux/'; $files = ftp_nlist($ftpconn, $path); foreach ($files AS $filelist) { echo $filelist, "\n"; } } } ?> (I won't quote here what Sara said about this bug report on IRC.. :)