php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23004 The ftp_close or ftp_quit didn't send QUIT to server
Submitted: 2003-04-01 11:26 UTC Modified: 2003-04-02 18:56 UTC
From: wanght at hotmail dot com Assigned:
Status: Closed Package: FTP related
PHP Version: 4.3.1 OS: Window 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wanght at hotmail dot com
New email:
PHP Version: OS:

 

 [2003-04-01 11:26 UTC] wanght at hotmail dot com
I take look at source code of PHP 4.3.1, there are two functions ftp_close and ftp_quit in ftp.c, But the PHP funcions ftp_close and ftp_quit in php_ftp.c didn't invoke these real function. What happens?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-02 11:12 UTC] sniper@php.net
Not enough information why this is a problem.
(if you know how PHP works, you'd know that the ftp_quit() is called in the resource destructor code)

 [2003-04-02 12:03 UTC] wanght at hotmail dot com
Sorry, Let me explain the problem further.

Following is my php script and ftp log. You can see there is not QUIT command in ftp log. As you know, the ftp_quit is alais of ftp_close in PHP, but I found two C function in ftp.c. The C function ftp_quit send QUIT to ftp server, but ftp_close didn't. I think this is the problem. In the FTP protocol, a client should send QUIT before disconnect the connection. I think the PHP ftp function should support that. Thnaks.
=====================
<?php
$host = "192.168.120.76";
$port = 21;
$user = "test";
$pass = "test";
$passive = FALSE;
$folder_path = "";
$file_path = "";

$ftp_conn = @ftp_connect($host, $port);
if ($ftp_conn === FALSE)
{
	echo "Can't connect with server: " . $host . "\n";
	exit(-1);
}
if (@ftp_login($ftp_conn, $user, $pass) === FALSE)
{
	echo "User name  or password is wrong \n";
	exit(-2);
}
ftp_quit($ftp_conn);
?>
=============
Wed Apr 02 11:55:08 2003  0  Incoming connection request on interface 192.168.120.176
Wed Apr 02 11:55:08 2003  0  Connection request accepted from 192.168.120.176
Wed Apr 02 11:55:09 2003  0  USER test
Wed Apr 02 11:55:09 2003  0  331 User test Ok, password please  
Wed Apr 02 11:55:09 2003  0  PASS ***********
Wed Apr 02 11:55:09 2003  0  230 Password Ok, User logged in  
Wed Apr 02 11:55:09 2003  0  The connection was closed by the remote socket.
Wed Apr 02 11:55:09 2003  0  Connection terminated.
==================================
 [2003-04-02 18:56 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC