[php-src] Issue #20240: FTP with SSL: ftp_fput(): Connection timed out on successful writes

From: Date: Mon, 20 Oct 2025 06:01:19 +0000
Subject: [php-src] Issue #20240: FTP with SSL: ftp_fput(): Connection timed out on successful writes
Groups: php.bugs 
Request: Send a blank email to [email protected] to get a copy of this message
Issue: https://github.com/php/php-src/issues/20240
Author: ionutantohi

### Description

The following code:

```php
<?php

set_error_handler(function ($severity, $message) {
    echo $message;
});

$host = '';
$user = '';
$pass = ''';

$connection = ftp_ssl_connect($host);
ftp_login($connection, $user, $pass);
ftp_pasv($connection, true);
ftp_fput($connection, 'test-upload.txt', fopen(__DIR__ . '/my-file.txt',
'r'), FTP_BINARY);
```

Resulted in this output:
```
ftp_fput(): Connection timed out exception
```

But even the if exception was raised, **the file is written successfully on the server.** 

But I expected this output instead:
```
no exception
```


### PHP Version

```plain
PHP 8.4.13 (cli) (built: Oct  1 2025 20:33:51) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.13, Copyright (c), by Zend Technologies
```

### Operating System

Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-157-generic x86_64)


Thread (1 message)

  • ionutantohi
« previous php.bugs (#251092) next »