diff options
Diffstat (limited to 'ext/ftp')
-rw-r--r-- | ext/ftp/tests/004.phpt | 58 | ||||
-rw-r--r-- | ext/ftp/tests/006.phpt | 108 | ||||
-rw-r--r-- | ext/ftp/tests/007.phpt | 331 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_get_basic.phpt | 6 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_ssl_connect_error.phpt | 20 |
5 files changed, 205 insertions, 318 deletions
diff --git a/ext/ftp/tests/004.phpt b/ext/ftp/tests/004.phpt index 3fcf272e3b..b95c12c518 100644 --- a/ext/ftp/tests/004.phpt +++ b/ext/ftp/tests/004.phpt @@ -8,68 +8,22 @@ require 'skipif.inc'; <?php require 'server.inc'; +// Negative timeout +var_dump(ftp_connect('127.0.0.1', 0, -3)); + $ftp = ftp_connect('127.0.0.1', $port); if (!$ftp) die("Couldn't connect to the server"); var_dump(ftp_login($ftp, 'user', 'pass')); - -var_dump(ftp_systype($ftp)); - -/* some bogus usage */ -var_dump(ftp_alloc($ftp, array())); -var_dump(ftp_cdup($ftp, 0)); -var_dump(ftp_chdir($ftp, array())); -var_dump(ftp_chmod($ftp, 0666)); -var_dump(ftp_close()); -var_dump(ftp_connect('sfjkfjaksfjkasjf')); -var_dump(ftp_delete($ftp, array())); -var_dump(ftp_exec($ftp, array())); - -var_dump(ftp_systype($ftp, 0)); -var_dump(ftp_pwd($ftp, array())); - -var_dump(ftp_login($ftp)); var_dump(ftp_login($ftp, 'user', 'bogus')); var_dump(ftp_quit($ftp)); ?> --EXPECTF-- -bool(true) -string(4) "UNIX" - -Warning: ftp_alloc() expects parameter 2 to be int, array given in %s004.php on line 12 -bool(false) - -Warning: ftp_cdup() expects exactly 1 parameter, 2 given in %s004.php on line 13 -NULL - -Warning: ftp_chdir() expects parameter 2 to be string, array given in %s004.php on line 14 -NULL - -Warning: ftp_chmod() expects exactly 3 parameters, 2 given in %s on line %d +Warning: ftp_connect(): Timeout has to be greater than 0 in %s on line %d bool(false) +bool(true) -Warning: ftp_close() expects exactly 1 parameter, 0 given in %s004.php on line 16 -NULL - -Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s004.php on line 17 -bool(false) - -Warning: ftp_delete() expects parameter 2 to be string, array given in %s004.php on line 18 -NULL - -Warning: ftp_exec() expects parameter 2 to be string, array given in %s004.php on line 19 -NULL - -Warning: ftp_systype() expects exactly 1 parameter, 2 given in %s004.php on line 21 -NULL - -Warning: ftp_pwd() expects exactly 1 parameter, 2 given in %s004.php on line 22 -NULL - -Warning: ftp_login() expects exactly 3 parameters, 1 given in %s004.php on line 24 -NULL - -Warning: ftp_login(): Not logged in. in %s004.php on line 25 +Warning: ftp_login(): Not logged in. in %s on line %d bool(false) bool(true) diff --git a/ext/ftp/tests/006.phpt b/ext/ftp/tests/006.phpt deleted file mode 100644 index ff0d258917..0000000000 --- a/ext/ftp/tests/006.phpt +++ /dev/null @@ -1,108 +0,0 @@ ---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)); -var_dump(ftp_mlsd($ftp)); -var_dump(ftp_append($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 3 parameters, 1 given in %s006.php on line 11 -NULL - -Warning: ftp_nb_fget() expects at least 3 parameters, 1 given in %s006.php on line 12 -NULL - -Warning: ftp_nb_get() expects at least 3 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 3 parameters, 0 given in %s006.php on line 16 -NULL - -Warning: ftp_nb_fput() expects at least 3 parameters, 1 given in %s006.php on line 17 -NULL - -Warning: ftp_put() expects at least 3 parameters, 1 given in %s006.php on line 18 -NULL - -Warning: ftp_nb_put() expects at least 3 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 - -Warning: ftp_mlsd() expects exactly 2 parameters, 1 given in %s006.php on line 26 -NULL - -Warning: ftp_append() expects at least 3 parameters, 1 given in %s006.php on line 27 -NULL diff --git a/ext/ftp/tests/007.phpt b/ext/ftp/tests/007.phpt index eebe8cf1e3..0520b37293 100644 --- a/ext/ftp/tests/007.phpt +++ b/ext/ftp/tests/007.phpt @@ -11,138 +11,205 @@ require 'skipif.inc'; <?php $ftp = tmpfile(); -var_dump(ftp_login($ftp, 'user', 'pass')); -var_dump(ftp_pwd($ftp)); -var_dump(ftp_cdup($ftp)); -var_dump(ftp_chdir($ftp, '~')); -var_dump(ftp_exec($ftp, 'x')); -var_dump(ftp_raw($ftp, 'x')); -var_dump(ftp_mkdir($ftp, '/')); -var_dump(ftp_rmdir($ftp, '/')); -var_dump(ftp_chmod($ftp, 7777, '/')); -var_dump(ftp_alloc($ftp, 7777)); -var_dump(ftp_nlist($ftp, '/')); -var_dump(ftp_rawlist($ftp, '~')); -var_dump(ftp_mlsd($ftp, '~')); -var_dump(ftp_systype($ftp)); -var_dump(ftp_fget($ftp, $ftp, 'remote', 7777)); -var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777)); -var_dump(ftp_pasv($ftp, false)); -var_dump(ftp_get($ftp, 'local', 'remote', 7777)); -var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777)); -var_dump(ftp_nb_continue($ftp)); -var_dump(ftp_fput($ftp, 'remote', $ftp, 9999)); -var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999)); -var_dump(ftp_put($ftp, 'remote', 'local', 9999)); -var_dump(ftp_append($ftp, 'remote', 'local', 9999)); -var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999)); -var_dump(ftp_size($ftp, '~')); -var_dump(ftp_mdtm($ftp, '~')); -var_dump(ftp_rename($ftp, 'old', 'new')); -var_dump(ftp_delete($ftp, 'gone')); -var_dump(ftp_site($ftp, 'localhost')); -var_dump(ftp_close($ftp)); -var_dump(ftp_set_option($ftp, 1, 2)); -var_dump(ftp_get_option($ftp, 1)); +try { + var_dump(ftp_login($ftp, 'user', 'pass')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_pwd($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_cdup($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_chdir($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_exec($ftp, 'x')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_raw($ftp, 'x')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_mkdir($ftp, '/')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_rmdir($ftp, '/')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_chmod($ftp, 7777, '/')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_alloc($ftp, 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nlist($ftp, '/')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_rawlist($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_mlsd($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_systype($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_fget($ftp, $ftp, 'remote', 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_pasv($ftp, false)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_get($ftp, 'local', 'remote', 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_continue($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_fput($ftp, 'remote', $ftp, 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_put($ftp, 'remote', 'local', 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_append($ftp, 'remote', 'local', 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_size($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_mdtm($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_rename($ftp, 'old', 'new')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_delete($ftp, 'gone')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_site($ftp, 'localhost')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_close($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_set_option($ftp, 1, 2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_get_option($ftp, 1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} fclose($ftp); ?> ---EXPECTF-- -Warning: ftp_login(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_pwd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_cdup(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_chdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_exec(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_raw(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_mkdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_rmdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_chmod(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_alloc(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_rawlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_mlsd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_systype(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_pasv(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_append(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_size(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_mdtm(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_rename(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_delete(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_site(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_close(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_set_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_get_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) +--EXPECT-- +ftp_login(): supplied resource is not a valid FTP Buffer resource +ftp_pwd(): supplied resource is not a valid FTP Buffer resource +ftp_cdup(): supplied resource is not a valid FTP Buffer resource +ftp_chdir(): supplied resource is not a valid FTP Buffer resource +ftp_exec(): supplied resource is not a valid FTP Buffer resource +ftp_raw(): supplied resource is not a valid FTP Buffer resource +ftp_mkdir(): supplied resource is not a valid FTP Buffer resource +ftp_rmdir(): supplied resource is not a valid FTP Buffer resource +ftp_chmod(): supplied resource is not a valid FTP Buffer resource +ftp_alloc(): supplied resource is not a valid FTP Buffer resource +ftp_nlist(): supplied resource is not a valid FTP Buffer resource +ftp_rawlist(): supplied resource is not a valid FTP Buffer resource +ftp_mlsd(): supplied resource is not a valid FTP Buffer resource +ftp_systype(): supplied resource is not a valid FTP Buffer resource +ftp_fget(): supplied resource is not a valid FTP Buffer resource +ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource +ftp_pasv(): supplied resource is not a valid FTP Buffer resource +ftp_get(): supplied resource is not a valid FTP Buffer resource +ftp_nb_get(): supplied resource is not a valid FTP Buffer resource +ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource +ftp_fput(): supplied resource is not a valid FTP Buffer resource +ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource +ftp_put(): supplied resource is not a valid FTP Buffer resource +ftp_append(): supplied resource is not a valid FTP Buffer resource +ftp_nb_put(): supplied resource is not a valid FTP Buffer resource +ftp_size(): supplied resource is not a valid FTP Buffer resource +ftp_mdtm(): supplied resource is not a valid FTP Buffer resource +ftp_rename(): supplied resource is not a valid FTP Buffer resource +ftp_delete(): supplied resource is not a valid FTP Buffer resource +ftp_site(): supplied resource is not a valid FTP Buffer resource +ftp_close(): supplied resource is not a valid FTP Buffer resource +ftp_set_option(): supplied resource is not a valid FTP Buffer resource +ftp_get_option(): supplied resource is not a valid FTP Buffer resource diff --git a/ext/ftp/tests/ftp_get_basic.phpt b/ext/ftp/tests/ftp_get_basic.phpt index 2c5f6f58a6..c52ea56218 100644 --- a/ext/ftp/tests/ftp_get_basic.phpt +++ b/ext/ftp/tests/ftp_get_basic.phpt @@ -29,9 +29,6 @@ unlink($tmpfname); //test non-existent file request ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII); - -//test invalid ftp_get params -var_dump(ftp_get('foo', 'bar', 'baz')); ?> --EXPECTF-- bool(true) @@ -41,6 +38,3 @@ bool(true) string(21) "BINARYFoo%00Bar%0D%0A" Warning: ftp_get(): a warning: No such file or directory in %sftp_get_basic.php on line %d - -Warning: ftp_get() expects parameter 1 to be resource, string given in %s on line %d -NULL diff --git a/ext/ftp/tests/ftp_ssl_connect_error.phpt b/ext/ftp/tests/ftp_ssl_connect_error.phpt index b0ece5d63b..13c8f9e9c0 100644 --- a/ext/ftp/tests/ftp_ssl_connect_error.phpt +++ b/ext/ftp/tests/ftp_ssl_connect_error.phpt @@ -12,14 +12,6 @@ echo "*** Testing ftp_ssl_connect() function : error conditions ***\n"; echo "\n-- Testing ftp_ssl_connect() function on failure --\n"; var_dump(ftp_ssl_connect('totes.invalid')); -echo "\n-- Testing ftp_ssl_connect() function invalid argument type --\n"; -ftp_ssl_connect([]); -ftp_ssl_connect('totes.invalid', []); -ftp_ssl_connect('totes.invalid', 21, []); - -echo "\n-- Testing ftp_ssl_connect() function with more than expected no. of arguments --\n"; -ftp_ssl_connect('totes.invalid', 21, 1, []); - echo "\n-- Testing ftp_ssl_connect() function timeout warning for value 0 --\n"; ftp_ssl_connect('totes.invalid', 21, 0); @@ -32,18 +24,6 @@ echo "===DONE===\n"; Warning: ftp_ssl_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s on line %d bool(false) --- Testing ftp_ssl_connect() function invalid argument type -- - -Warning: ftp_ssl_connect() expects parameter 1 to be string, array given in %s on line %d - -Warning: ftp_ssl_connect() expects parameter 2 to be int, array given in %s on line %d - -Warning: ftp_ssl_connect() expects parameter 3 to be int, array given in %s on line %d - --- Testing ftp_ssl_connect() function with more than expected no. of arguments -- - -Warning: ftp_ssl_connect() expects at most 3 parameters, 4 given in %s on line %d - -- Testing ftp_ssl_connect() function timeout warning for value 0 -- Warning: ftp_ssl_connect(): Timeout has to be greater than 0 in %s on line %d |