xref: /php-src/ext/ftp/tests/dead-resource.phpt (revision f39b5c4c)
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?>
22--EXPECT--
23bool(true)
24bool(true)
25Exception: FTP\Connection is already closed
26