ID: 41352
Updated by: [EMAIL PROTECTED]
Reported By: guy dot vleugels at kaneka dot be
-Status: Open
+Status: Feedback
Bug Type: FTP related
Operating System: RH9
PHP Version: 5.2.2
New Comment:
The server is in passive mode, so your starts working fine as soon as I
add ftp_pasv($ftpcnn, true);.
Previous Comments:
------------------------------------------------------------------------
[2007-05-11 09:15:23] guy dot vleugels at kaneka dot be
This should be a working example with existing files on our
ftp-server.
It reproduces the possible bug.
Please change "<aCertainDirectory>" with a directory which is writable
for you php-user.
// ---------------------------------------------------------------
// ftp connection
$ftpcnn = ftp_connect("ftp.kaneka.be", "21");
// login with username and password
$ftprs = ftp_login($ftpcnn, "anonymous", "myemailaddress");
// check connection
if( (!$ftpcnn) || (!$ftprs) )
{
echo "FTP connection has failed!<br />";
echo "Attempted to connect to the build-in ftp server of
Hylafax!";
exit;
}
// Download q-file which contains name of ps-file
ftp_get( $ftpcnn, "<aCertainDirectory>/q1950", "/pub/q1950", FTP_ASCII
);
// Get the name of the postscript-file which contains the actual
document data
$lines = file( "<aCertainDirectory>/q1950" ); // file Reads entire
file into an array
foreach( $lines as $line )
{
if( strstr($line, "!postscript") !== FALSE ) // ea. $line =
"!postscript:0::docxxxx.ps"
{
$temp = explode( ":", $line );
$psfile = $temp[3];
echo $psfile;
}
}
// Download the ps file
ftp_get( $ftpcnn, "<aCertainDirectory>/$psfile", "/pub/$psfile",
FTP_ASCII ); // ftp_get() retrieves a remote file from the FTP server,
and saves it into a local file.
// close the connection
ftp_close( $ftpcnn );
// ---------------------------------------------------------
------------------------------------------------------------------------
[2007-05-11 08:06:52] [EMAIL PROTECTED]
Is there a public FTP server (or is it possible to create one) which
demonstrates the same problem?
------------------------------------------------------------------------
[2007-05-11 06:00:46] guy dot vleugels at kaneka dot be
To be honest, there is no real location to reproduce this possible bug,
because the website is only on our companie's intranet.
------------------------------------------------------------------------
[2007-05-10 20:13:52] [EMAIL PROTECTED]
Where can we reproduce it?
------------------------------------------------------------------------
[2007-05-10 13:06:26] guy dot vleugels at kaneka dot be
Description:
------------
After upgrading to PHP 5.2.2 on my RH9-machine the following error
warning occurs on post-script files using ftp_get:
Warning: ftp_get() [function.ftp-get]: PORT command successful
As a result, the post-script file won't be downloaded to my machine.
If I do a downgrade to < PHP5.2.2, everything works perfectly.
Reproduce code:
---------------
$ftpcnn = ftp_connect("ftp-server", "4559");
// login with username and password
$ftprs = ftp_login($ftpcnn, "user", "passwd");
// check connection
if( (!$ftpcnn) || (!$ftprs) )
{
echo "FTP connection has failed!<br />";
exit;
}
// Firstly download txt-file
ftp_get( $ftpcnn, "/mydir/txtfile", "/ftpdir/txtfileonftp", FTP_BINARY
);
// ---- Do some extra stuff -----------------------
// Get the name of the postscript-file
$lines = file( "mydir/txtfile" );
foreach( $lines as $line )
{
if( strstr($line, "!postscript") !== FALSE ) // ea. $line =
"!postscript:0::docq/doc1764.ps"
{
$temp = explode( ":", $line );
$psfile = $temp[3];
}
}
// --- End some extra stuff -------------------
// Code which causes the warning:
// Warning: ftp_get() [function.ftp-get]: PORT command successful.
// Download the ps file
ftp_get( $ftpcnn, "/mydir/psfile", $psfile, FTP_BINARY );
// close the connection
ftp_close( $ftpcnn );
Expected result:
----------------
// Downloading of a file specified by arguments in ftp_get()
Actual result:
--------------
Warning: ftp_get() [function.ftp-get]: PORT command successful
File won't be downloaded
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41352&edit=1