Bug #41352 [Com]: Warning: ftp_get() PORT command successful

From: Date: Sun, 31 Jul 2011 14:38:40 +0000
Subject: Bug #41352 [Com]: Warning: ftp_get() PORT command successful
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-162307@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=41352&edit=1

 ID:                 41352
 Comment by:         fijo dot com at googlemail dot com
 Reported by:        guy dot vleugels at kaneka dot be
 Summary:            Warning: ftp_get() PORT command successful
 Status:             Closed
 Type:               Bug
 Package:            FTP related
 Operating System:   RH9
 PHP Version:        5.2.2
 Block user comment: N
 Private report:     N

 New Comment:

> Is there a public FTP server (or is it possible to create one) which 
demonstrates the same problem?

I got this problem while using my ftp-server on funpic.de

Thats a free hosting service (so you can use it to reproduce that exeption) from 
that it produces those errors for me, too.

XAMPP 1.7.4; PHP 5.3.5; linux


Previous Comments:
------------------------------------------------------------------------
[2007-06-07 07:33:07] guy dot vleugels at kaneka dot be

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

------------------------------------------------------------------------
[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] tony2001@php.net

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 );

// ---------------------------------------------------------

------------------------------------------------------------------------


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

    https://bugs.php.net/bug.php?id=41352


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=41352&edit=1


Thread (10 messages)

« previous php.bugs (#162307) next »