xref: /PHP-8.0/ext/ftp/tests/004.phpt (revision 1410cd6b)
1--TEST--
2FTP with bogus parameters
3--SKIPIF--
4<?php
5require 'skipif.inc';
6?>
7--FILE--
8<?php
9require 'server.inc';
10
11// Negative timeout
12try {
13    ftp_connect('127.0.0.1', 0, -3);
14} catch (ValueError $exception) {
15    echo $exception->getMessage() . "\n";
16}
17
18$ftp = ftp_connect('127.0.0.1', $port);
19if (!$ftp) die("Couldn't connect to the server");
20
21var_dump(ftp_login($ftp, 'user', 'pass'));
22var_dump(ftp_login($ftp, 'user', 'bogus'));
23
24var_dump(ftp_quit($ftp));
25?>
26--EXPECTF--
27ftp_connect(): Argument #3 ($timeout) must be greater than 0
28bool(true)
29
30Warning: ftp_login(): Not logged in. in %s on line %d
31bool(false)
32bool(true)
33