xref: /PHP-8.4/ext/ftp/tests/bug39458.phpt (revision e9f783fc)
1--TEST--
2Bug #39458 (ftp_nlist() returns false on empty directories)
3--EXTENSIONS--
4ftp
5pcntl
6--FILE--
7<?php
8require 'server.inc';
9
10$ftp = ftp_connect('127.0.0.1', $port);
11if (!$ftp) die("Couldn't connect to the server");
12
13var_dump(ftp_login($ftp, 'user', 'pass'));
14
15var_dump(ftp_nlist($ftp, ''));
16var_dump(ftp_nlist($ftp, 'emptydir'));
17var_dump(ftp_nlist($ftp, 'bogusdir'));
18
19ftp_close($ftp);
20?>
21--EXPECT--
22bool(true)
23array(3) {
24  [0]=>
25  string(5) "file1"
26  [1]=>
27  string(5) "file1"
28  [2]=>
29  string(9) "file
30b0rk"
31}
32array(0) {
33}
34bool(false)
35