php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44059 Able to get more infos about FTP
Submitted: 2008-02-06 08:17 UTC Modified: 2021-07-07 10:21 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:2 of 3 (66.7%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: daniel dot chobe at nextiraone dot de Assigned:
Status: Open Package: FTP related
PHP Version: 5.2.5 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: daniel dot chobe at nextiraone dot de
New email:
PHP Version: OS:

 

 [2008-02-06 08:17 UTC] daniel dot chobe at nextiraone dot de
Description:
------------
The FTP Extension dont show the choosen passiv port. But sometime it helps if your have problem with your connection.

The other thing your can get is the last ftp responseline. It also helps in case of problems with FTP Connections.



Reproduce code:
---------------
<?php
# Connect, Login, Uploads, get Information

$conn_id = ftp_connect($ftp_server); 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); 
echo ftp_get_option($conn_id, FTP_LASTRESPONSE).PHP_EOL;
echo ftp_get_option($conn_id, FTP_PASSIVPORT).PHP_EOL;
ftp_close($conn_id); 
?>

Expected result:
----------------
226 Transfer complete
43020


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-06 08:19 UTC] daniel dot chobe at nextiraone dot de
--- ftp_save/php_ftp.c  2006-10-23 09:23:23.000000000 +0200
+++ ftp/php_ftp.c       2006-10-23 10:58:54.000000000 +0200
@@ -120,6 +120,10 @@
        REGISTER_LONG_CONSTANT("FTP_FAILED", PHP_FTP_FAILED, CONST_PERSISTENT | CONST_CS);
        REGISTER_LONG_CONSTANT("FTP_FINISHED", PHP_FTP_FINISHED, CONST_PERSISTENT | CONST_CS);
        REGISTER_LONG_CONSTANT("FTP_MOREDATA", PHP_FTP_MOREDATA, CONST_PERSISTENT | CONST_CS);
+
+       REGISTER_LONG_CONSTANT("FTP_PASSIVPORT", PHP_FTP_PASSIVPORT, CONST_PERSISTENT | CONST_CS);
+       REGISTER_LONG_CONSTANT("FTP_LASTRESPONSE", PHP_FTP_LASTRESPONSE, CONST_PERSISTENT | CONST_CS);
+
        return SUCCESS;
 }
 
@@ -1195,6 +1199,10 @@
                case PHP_FTP_OPT_AUTOSEEK:
                        RETURN_BOOL(ftp->autoseek);
                        break;
+               case PHP_FTP_LASTRESPONSE:
+                       RETURN_STRING(ftp->inbuf, 1);
+                       break;
+               case PHP_FTP_PASSIVPORT:
+                       RETURN_LONG(((struct sockaddr_in *)& ftp->pasvaddr)->sin_port);
+                       break;
                default:
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%ld'", option);
                        RETURN_FALSE;
diff --new-file -u -r ftp_save/php_ftp.h ftp/php_ftp.h
--- ftp_save/php_ftp.h  2006-10-23 09:23:23.000000000 +0200
+++ ftp/php_ftp.h       2006-10-23 09:24:12.000000000 +0200
@@ -29,6 +29,8 @@
 
 #define PHP_FTP_OPT_TIMEOUT_SEC        0
 #define PHP_FTP_OPT_AUTOSEEK   1
+#define PHP_FTP_LASTRESPONSE   2
+#define PHP_FTP_PASSIVPORT     3
 #define PHP_FTP_AUTORESUME             -1
 
 PHP_MINIT_FUNCTION(ftp);
 [2009-04-17 06:54 UTC] daniel dot buschke at nextiraone dot de
Could someone write a statement, please?

It would be nice to know if this patch has any chance to get into the tree.
 [2011-04-08 21:27 UTC] jani@php.net
-Package: Feature/Change Request +Package: FTP related
 [2021-07-07 10:21 UTC] cmb@php.net
> Could someone write a statement, please?

Consider to provide a PR[1] for better visibility.

[1] <https://github.com/php/php-src/pulls>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 11 14:02:33 2024 UTC