com php-src: Merge branch 'PHP-7.2': ext/ftp/php_ftp.c

From: Date: Wed, 02 Aug 2017 18:53:32 +0000
Subject: com php-src: Merge branch 'PHP-7.2': ext/ftp/php_ftp.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-98929@lists.php.net to get a copy of this message
Commit: 902188e5e3889886d609696a7b5ed8ac12e071e2 Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 2 Aug 2017 20:53:32 +0200 Parents: e9b572f920bfd16385bed4a5e1c4058488d9c8af 29e4d4eee6b1e7b01892233caa634056b2f3dc10 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=902188e5e3889886d609696a7b5ed8ac12e071e2 Log: Merge branch 'PHP-7.2' Changed paths: MM ext/ftp/php_ftp.c Diff: diff --cc ext/ftp/php_ftp.c index 8c59c49,eb6589e..849e11b --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@@ -1272,8 -1280,43 +1280,43 @@@ PHP_FUNCTION(ftp_put } /* }}} */ + /* {{{ proto bool ftp_append(resource stream, string remote_file, string local_file, int mode) + Append content of a file a another file on the FTP server */ + PHP_FUNCTION(ftp_append) + { + zval *z_ftp; + ftpbuf_t *ftp; + ftptype_t xtype; + char *remote, *local; + size_t remote_len, local_len; + zend_long mode; + php_stream *instream; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rppl", &z_ftp, &remote, &remote_len, &local, &local_len, &mode) == FAILURE) { + return; + } + + if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) { + RETURN_FALSE; + } + XTYPE(xtype, mode); + + if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : "rb", REPORT_ERRORS, NULL))) { + RETURN_FALSE; + } + + if (!ftp_append(ftp, remote, remote_len, instream, xtype)) { + php_stream_close(instream); + php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf); + RETURN_FALSE; + } + php_stream_close(instream); + + RETURN_TRUE; + } + /* }}} */ -/* {{{ proto int ftp_nb_put(resource stream, string remote_file, string local_file, int mode[, int startpos]) +/* {{{ proto int ftp_nb_put(resource stream, string remote_file, string local_file [, int mode [, int startpos]]) Stores a file on the FTP server */ PHP_FUNCTION(ftp_nb_put) {

« previous php.cvs (#98929) next »