--- embedaddon/php/ext/ftp/php_ftp.c 2013/10/14 08:02:19 1.1.1.4 +++ embedaddon/php/ext/ftp/php_ftp.c 2014/06/15 20:03:48 1.1.1.5 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ftp.c,v 1.1.1.4 2013/10/14 08:02:19 misho Exp $ */ +/* $Id: php_ftp.c,v 1.1.1.5 2014/06/15 20:03:48 misho Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -963,12 +963,16 @@ PHP_FUNCTION(ftp_nb_get) if ((ret = ftp_nb_get(ftp, outstream, remote, xtype, resumepos TSRMLS_CC)) == PHP_FTP_FAILED) { php_stream_close(outstream); + ftp->stream = NULL; VCWD_UNLINK(local); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); RETURN_LONG(PHP_FTP_FAILED); } - php_stream_close(outstream); + if (ret == PHP_FTP_FINISHED){ + php_stream_close(outstream); + ftp->stream = NULL; + } RETURN_LONG(ret); } @@ -1001,6 +1005,7 @@ PHP_FUNCTION(ftp_nb_continue) if (ret != PHP_FTP_MOREDATA && ftp->closestream) { php_stream_close(ftp->stream); + ftp->stream = NULL; } if (ret == PHP_FTP_FAILED) { @@ -1212,6 +1217,7 @@ PHP_FUNCTION(ftp_nb_put) if (ret != PHP_FTP_MOREDATA) { php_stream_close(instream); + ftp->stream = NULL; } if (ret == PHP_FTP_FAILED) {