[php-src] Issue #20849: ftp_nlist, ftp_mlsd not working anymore since PHP 8.5.x , same code works fine in PHP 8.4.x
[email protected] (lubber-de)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/20849
Author: lubber-de
### Description
We have a FTP Server setup untouched since ages via WIndows IIS 8.5
The following code works fine in (8.4.x, but breaks in 8.5.x):
```php
<?php
$tempName = tempnam(sys_get_temp_dir(), 'x');
$remoteDir = '/testdir';
$remoteFile = $remoteDir . '/text.txt';
// works in PHP 8.4.x and 8.5.x :)
$fCon = ftp_ssl_connect('servername');
// works in PHP 8.4.x and 8.5.x :)
$fLogin = ftp_login($fCon,'user','pass');
// works in PHP 8.4.x and 8.5.x :)
ftp_pasv($fCon, true);
// works in PHP 8.4.x :)
// timeout in 8.5.x :(
$files = ftp_nlist($fCon, $remoteDir);
// works in PHP 8.4.x :)
// false in 8.5.x :(
$files2 = ftp_mlsd($fCon, $remoteDir);
// works in PHP 8.4.x and 8.5.x :)
ftp_get($fCon, $tempName, $remoteFile, FTP_BINARY);
// works in PHP 8.4.x and 8.5.x (when not using ftp_nlist/mlsd, otherwise fatal error)
ftp_close($fCon);```
Every ftp method works, just not the directory listing methods
### PHP Version
```plain
PHP 8.5.1 (cli) (built: Dec 17 2025 10:54:30) (NTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Zend Engine v4.5.1, Copyright (c) Zend Technologies
with Zend OPcache v8.5.1, Copyright (c), by Zend Technologies
```
### Operating System
Windows Server 2019