ID: 44059
Comment by: daniel dot buschke at nextiraone dot de
Reported By: daniel dot chobe at nextiraone dot de
Status: Open
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 5.2.5
New Comment:
Could someone write a statement, please?
It would be nice to know if this patch has any chance to get into the
tree.
Previous Comments:
------------------------------------------------------------------------
[2008-02-06 08:19:26] 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);
------------------------------------------------------------------------
[2008-02-06 08:17:46] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44059&edit=1