xref: /PHP-8.2/ext/ftp/tests/dead-resource.phpt (revision 68224f2a)
1--TEST--
2Attempt to use a closed FTP\Connection
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");
12var_dump(ftp_login($ftp, 'user', 'pass'));
13var_dump(ftp_close($ftp));
14
15try {
16    var_dump(ftp_login($ftp, 'user', 'pass'));
17    echo "Login did not throw\n";
18} catch (ValueError $ex) {
19    echo "Exception: ", $ex->getMessage(), "\n";
20}
21--EXPECT--
22bool(true)
23bool(true)
24Exception: FTP\Connection is already closed
25