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