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