ID: 41352
User updated by: guy dot vleugels at kaneka dot be
Reported By: guy dot vleugels at kaneka dot be
-Status: No Feedback
+Status: Closed
Bug Type: FTP related
Operating System: RH9
PHP Version: 5.2.2
New Comment:
I've found what seemed to be the problem.
When a text-file is downloaded through the ftp_get()-function and the
file is loaded into an array using the file()-function, the separate
lines of the array aren't trimmed by default (so you have to use the
trim()-function on each line of the array).
So this isn't a bug, but only a behaviour change of the file()-function
or the ftp_get()-function as of PHP > 5.2.1
Previous Comments:
------------------------------------------------------------------------
[2007-05-23 09:39:45] tobylewis at logogriph dot com
Running PHP 5.0.4 (from www.entropy.ch) on Mac OS X 10.4.9
I am also seeing this error but on just about all ftp commands.
I suspect some ftp servers return a status string "PORT command
successful" which php is passing along as a warning but since this
message is not intended as a warning it is annoying to receive the
"error". Trying to block the unwanted error with the at symbol is not
ideal since that would deflect genuine errors too.
------------------------------------------------------------------------
[2007-05-19 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2007-05-11 11:26:21] [EMAIL PROTECTED]
The server is in passive mode, so your starts working fine as soon as I
add ftp_pasv($ftpcnn, true);.
------------------------------------------------------------------------
[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?
------------------------------------------------------------------------
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/41352
--
Edit this bug report at http://bugs.php.net/?id=41352&edit=1