summaryrefslogtreecommitdiff
path: root/ext/ftp/tests/ftp_set_option_errors.phpt
blob: 1ad8a072c925626cd024a60cdef83f828b2228e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--TEST--
Testing ftp_set_option erros while setting up
--CREDITS--
Gabriel Caruso (carusogabriel34@gmail.com)
--SKIPIF--
<?php require 'skipif.inc'; ?>
--FILE--
<?php
require 'server.inc';
define('FOO_BAR', 10);

$ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
$ftp or die("Couldn't connect to the server");

var_dump(ftp_set_option($ftp, FTP_TIMEOUT_SEC, 0));
var_dump(ftp_set_option($ftp, FTP_TIMEOUT_SEC, '0'));
var_dump(ftp_set_option($ftp, FTP_USEPASVADDRESS, ['1']));
var_dump(ftp_set_option($ftp, FTP_AUTOSEEK, 'true'));
var_dump(ftp_set_option($ftp, FOO_BAR, 1));
?>
--EXPECTF--
Warning: ftp_set_option(): Timeout has to be greater than 0 in %s on line %d
bool(false)

Warning: ftp_set_option(): Option TIMEOUT_SEC expects value of type int, string given in %s on line %d
bool(false)

Warning: ftp_set_option(): Option USEPASVADDRESS expects value of type bool, array given in %s on line %d
bool(false)

Warning: ftp_set_option(): Option AUTOSEEK expects value of type bool, string given in %s on line %d
bool(false)

Warning: ftp_set_option(): Unknown option '10' in %s on line %d
bool(false)