Also fix bug #46295 in ftp_fsock class.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9822 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Andreas Fischer 2009-07-22 03:02:45 +00:00
parent 2a84b76f30
commit 16e393b61d

View file

@ -483,7 +483,7 @@ class ftp extends transfer
$item = str_replace('\\', '/', $item); $item = str_replace('\\', '/', $item);
$dir = str_replace('\\', '/', $dir); $dir = str_replace('\\', '/', $dir);
if (strpos($item, $dir) === 0) if (!empty($dir) && strpos($item, $dir) === 0)
{ {
$item = substr($item, strlen($dir)); $item = substr($item, strlen($dir));
} }
@ -749,6 +749,20 @@ class ftp_fsock extends transfer
// Clear buffer // Clear buffer
$this->_check_command(); $this->_check_command();
// See bug #46295 - Some FTP daemons don't like './'
if ($dir === './' && empty($list))
{
// Let's try some alternatives
$list = $this->_ls('.');
if (empty($list))
{
$list = $this->_ls('');
}
return $list;
}
// Remove path if prepended // Remove path if prepended
foreach ($list as $key => $item) foreach ($list as $key => $item)
{ {
@ -756,7 +770,7 @@ class ftp_fsock extends transfer
$item = str_replace('\\', '/', $item); $item = str_replace('\\', '/', $item);
$dir = str_replace('\\', '/', $dir); $dir = str_replace('\\', '/', $dir);
if (strpos($item, $dir) === 0) if (!empty($dir) && strpos($item, $dir) === 0)
{ {
$item = substr($item, strlen($dir)); $item = substr($item, strlen($dir));
} }