xref: /PHP-8.3/ext/ftp/tests/005.phpt (revision e9f783fc)
1--TEST--
2FTP with bogus server responses
3--EXTENSIONS--
4ftp
5pcntl
6--FILE--
7<?php
8$bogus = 1;
9require 'server.inc';
10
11$ftp = ftp_connect('127.0.0.1', $port);
12if (!$ftp) die("Couldn't connect to the server");
13
14var_dump(ftp_login($ftp, 'anonymous', 'mail@example.com'));
15
16var_dump(ftp_alloc($ftp, 400));
17var_dump(ftp_cdup($ftp));
18var_dump(ftp_chdir($ftp, '~'));
19var_dump(ftp_chmod($ftp, 0666, 'x'));
20var_dump(ftp_delete($ftp, 'x'));
21var_dump(ftp_exec($ftp, 'x'));
22try {
23    ftp_fget($ftp, STDOUT, 'x', 0);
24} catch (ValueError $exception) {
25    echo $exception->getMessage() . "\n";
26}
27
28try {
29    ftp_fput($ftp, 'x', fopen(__FILE__, 'r'), 0);
30} catch (ValueError $exception) {
31    echo $exception->getMessage() . "\n";
32}
33
34try {
35    ftp_get($ftp, 'x', 'y', 0);
36} catch (ValueError $exception) {
37    echo $exception->getMessage() . "\n";
38}
39
40var_dump(ftp_mdtm($ftp, 'x'));
41var_dump(ftp_mkdir($ftp, 'x'));
42var_dump(ftp_nb_continue($ftp));
43
44try {
45    ftp_nb_fget($ftp, STDOUT, 'x', 0);
46} catch (ValueError $exception) {
47    echo $exception->getMessage() . "\n";
48}
49
50try {
51    ftp_nb_fput($ftp, 'x', fopen(__FILE__, 'r'), 0);
52} catch (ValueError $exception) {
53    echo $exception->getMessage() . "\n";
54}
55
56var_dump(ftp_systype($ftp));
57var_dump(ftp_pwd($ftp));
58var_dump(ftp_size($ftp, ''));
59var_dump(ftp_rmdir($ftp, ''));
60
61?>
62--EXPECTF--
63bool(true)
64bool(false)
65
66Warning: ftp_cdup(): Command not implemented (1). in %s005.php on line %d
67bool(false)
68
69Warning: ftp_chdir(): Command not implemented (2). in %s005.php on line %d
70bool(false)
71
72Warning: ftp_chmod(): Command not implemented (3). in %s005.php on line %d
73bool(false)
74
75Warning: ftp_delete(): Command not implemented (4). in %s005.php on line %d
76bool(false)
77
78Warning: ftp_exec(): Command not implemented (5). in %s005.php on line %d
79bool(false)
80ftp_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
81ftp_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
82ftp_get(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
83int(-1)
84
85Warning: ftp_mkdir(): Command not implemented (7). in %s005.php on line %d
86bool(false)
87
88Warning: ftp_nb_continue(): No nbronous transfer to continue in %s005.php on line %d
89int(0)
90ftp_nb_fget(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
91ftp_nb_fput(): Argument #4 ($mode) must be either FTP_ASCII or FTP_BINARY
92
93Warning: ftp_systype(): Command not implemented (8). in %s005.php on line %d
94bool(false)
95
96Warning: ftp_pwd(): Command not implemented (9). in %s005.php on line %d
97bool(false)
98int(-1)
99
100Warning: ftp_rmdir(): Command not implemented (11). in %s005.php on line %d
101bool(false)
102