[php-src] Issue #9348: FTP & SSL session reuse

From: Date: Tue, 16 Aug 2022 07:05:52 +0000
Subject: [php-src] Issue #9348: FTP & SSL session reuse
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242230@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9348 Author: janpecha ### Description Hello, FTP/SSL data connection fails after first data transfer, it results to error "425 Unable to build data connection: Operation not permitted". The following code: ```php <?php $f = ftp_ssl_connect('HOST'); ftp_login($f, 'USER', 'PASSWORD'); ftp_pasv($f, TRUE); var_dump(ftp_nlist($f, '*')); var_dump(ftp_nlist($f, '*')); ``` Resulted in this output: ``` array(2) { [0] => string(4) "dirA" [1] => string(9) "fileB.txt" } bool(false) ``` But I expected this output instead: ``` array(2) { [0] => string(4) "dirA" [1] => string(9) "fileB.txt" } array(2) { [0] => string(4) "dirA" [1] => string(9) "fileB.txt" } ``` If I change code and try upload a file: ``` <?php set_error_handler(function ($severity, $message) { echo $message; }); $f = ftp_ssl_connect('HOST'); ftp_login($f, 'USER', 'PASSWORD'); ftp_pasv($f, TRUE); ftp_fput($f, 'test-upload.txt', fopen(__DIR__ . '/my-file.txt', 'r'), FTP_BINARY); ``` It prints error 425 Unable to build data connection: Operation not permitted. Links: * https://github.com/php/php-src/commit/dfadc5a427b548cab2b7c037c05f65684e08a248 * http://proftpd.org/docs/contrib/mod_tls.html * http://www.proftpd.org/docs/howto/TLS.html (see section "Frequently Asked Questions") ### PHP Version PHP 8.1.8 & all version from PHP 5.6 ### Operating System Ubuntu 20.04

« previous php.bugs (#242230) next »