summaryrefslogtreecommitdiff
path: root/ext/ftp
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2006-11-24 20:18:54 +0000
committerNuno Lopes <nlopess@php.net>2006-11-24 20:18:54 +0000
commite8384cbccad5dfa39ea6932308ae7477ef99d853 (patch)
tree36e373feaa018454ed3b66cc890bc9d0df3f6396 /ext/ftp
parentd64b17543cfa5e171ca493eb3581eea0acd42dba (diff)
downloadphp-git-e8384cbccad5dfa39ea6932308ae7477ef99d853.tar.gz
more tests
Diffstat (limited to 'ext/ftp')
-rw-r--r--ext/ftp/tests/006.phpt100
-rw-r--r--ext/ftp/tests/bug39583.phpt1
-rw-r--r--ext/ftp/tests/server.inc2
3 files changed, 102 insertions, 1 deletions
diff --git a/ext/ftp/tests/006.phpt b/ext/ftp/tests/006.phpt
new file mode 100644
index 0000000000..4d31be78c0
--- /dev/null
+++ b/ext/ftp/tests/006.phpt
@@ -0,0 +1,100 @@
+--TEST--
+FTP with bogus parameters
+--SKIPIF--
+<?php
+require 'skipif.inc';
+?>
+--FILE--
+<?php
+$ftp=null;
+
+var_dump(ftp_connect(array()));
+var_dump(ftp_connect('127.0.0.1', 0, -3));
+var_dump(ftp_raw($ftp));
+var_dump(ftp_mkdir($ftp));
+var_dump(ftp_rmdir($ftp));
+var_dump(ftp_nlist($ftp));
+var_dump(ftp_rawlist($ftp));
+var_dump(ftp_fget($ftp));
+var_dump(ftp_nb_fget($ftp));
+var_dump(ftp_nb_get($ftp));
+var_dump(ftp_pasv($ftp));
+var_dump(ftp_nb_continue());
+var_dump(ftp_fput());
+var_dump(ftp_nb_fput($ftp));
+var_dump(ftp_put($ftp));
+var_dump(ftp_nb_put($ftp));
+var_dump(ftp_size($ftp));
+var_dump(ftp_mdtm($ftp));
+var_dump(ftp_rename($ftp));
+var_dump(ftp_site($ftp));
+var_dump(ftp_set_option($ftp));
+var_dump(ftp_get_option($ftp));
+
+?>
+--EXPECTF--
+Warning: ftp_connect() expects parameter 1 to be string, array given in %s006.php on line 4
+NULL
+
+Warning: ftp_connect(): Timeout has to be greater than 0 in %s006.php on line 5
+bool(false)
+
+Warning: ftp_raw() expects exactly 2 parameters, 1 given in %s006.php on line 6
+NULL
+
+Warning: ftp_mkdir() expects exactly 2 parameters, 1 given in %s006.php on line 7
+NULL
+
+Warning: ftp_rmdir() expects exactly 2 parameters, 1 given in %s006.php on line 8
+NULL
+
+Warning: ftp_nlist() expects exactly 2 parameters, 1 given in %s006.php on line 9
+NULL
+
+Warning: ftp_rawlist() expects at least 2 parameters, 1 given in %s006.php on line 10
+NULL
+
+Warning: ftp_fget() expects at least 4 parameters, 1 given in %s006.php on line 11
+NULL
+
+Warning: ftp_nb_fget() expects at least 4 parameters, 1 given in %s006.php on line 12
+NULL
+
+Warning: ftp_nb_get() expects at least 4 parameters, 1 given in %s006.php on line 13
+NULL
+
+Warning: ftp_pasv() expects exactly 2 parameters, 1 given in %s006.php on line 14
+NULL
+
+Warning: ftp_nb_continue() expects exactly 1 parameter, 0 given in %s006.php on line 15
+NULL
+
+Warning: ftp_fput() expects at least 4 parameters, 0 given in %s006.php on line 16
+NULL
+
+Warning: ftp_nb_fput() expects at least 4 parameters, 1 given in %s006.php on line 17
+NULL
+
+Warning: ftp_put() expects at least 4 parameters, 1 given in %s006.php on line 18
+NULL
+
+Warning: ftp_nb_put() expects at least 4 parameters, 1 given in %s006.php on line 19
+NULL
+
+Warning: ftp_size() expects exactly 2 parameters, 1 given in %s006.php on line 20
+NULL
+
+Warning: ftp_mdtm() expects exactly 2 parameters, 1 given in %s006.php on line 21
+NULL
+
+Warning: ftp_rename() expects exactly 3 parameters, 1 given in %s006.php on line 22
+NULL
+
+Warning: ftp_site() expects exactly 2 parameters, 1 given in %s006.php on line 23
+NULL
+
+Warning: ftp_set_option() expects exactly 3 parameters, 1 given in %s006.php on line 24
+NULL
+
+Warning: ftp_get_option() expects exactly 2 parameters, 1 given in %s006.php on line 25
+NULL
diff --git a/ext/ftp/tests/bug39583.phpt b/ext/ftp/tests/bug39583.phpt
index 47d9e30802..3c73758dc1 100644
--- a/ext/ftp/tests/bug39583.phpt
+++ b/ext/ftp/tests/bug39583.phpt
@@ -6,6 +6,7 @@ require 'skipif.inc';
?>
--FILE--
<?php
+$bug39583=1;
require 'server.inc';
$ftp = ftp_connect('127.0.0.1', $port);
diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc
index c2eef56980..7480d5c588 100644
--- a/ext/ftp/tests/server.inc
+++ b/ext/ftp/tests/server.inc
@@ -187,7 +187,7 @@ while($buf = fread($s, 4098)) {
if (isset($ascii) && !$ascii && $orig === $data) {
fputs($s, "226 Closing data Connection.\r\n");
- } elseif (!empty($ascii) && $data === strtr($orig, array("\r\n" => "\n", "\r" => "\n", "\n" => "\r\n"))) {
+ } elseif ((!empty($ascii) || isset($bug39583)) && $data === strtr($orig, array("\r\n" => "\n", "\r" => "\n", "\n" => "\r\n"))) {
fputs($s, "226 Closing data Connection.\r\n");
} else {