diff options
author | Andreas Treichel <gmblar+github@gmail.com> | 2017-02-02 01:09:31 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-02-17 21:31:18 +0100 |
commit | 5b1300b6c94b346310c0dd1eb3f89fd786229da4 (patch) | |
tree | 3fdd22d87ebdaaf4bc031c42e981464f3ed012e6 /ext/ftp/tests | |
parent | efefb5276b18f11871bf5405209013c11e5c9e20 (diff) | |
download | php-git-5b1300b6c94b346310c0dd1eb3f89fd786229da4.tar.gz |
ftp_mlsd(): Parse the MLSD response
Diffstat (limited to 'ext/ftp/tests')
-rw-r--r-- | ext/ftp/tests/ftp_mlsd.phpt | 97 | ||||
-rw-r--r-- | ext/ftp/tests/ftp_mlsd_empty_directory.phpt | 9 | ||||
-rw-r--r-- | ext/ftp/tests/server.inc | 4 |
3 files changed, 101 insertions, 9 deletions
diff --git a/ext/ftp/tests/ftp_mlsd.phpt b/ext/ftp/tests/ftp_mlsd.phpt new file mode 100644 index 0000000000..85da6b8028 --- /dev/null +++ b/ext/ftp/tests/ftp_mlsd.phpt @@ -0,0 +1,97 @@ +--TEST-- +ftp_mlsd() return parsed lines +--SKIPIF-- +<?php +require 'skipif.inc'; +?> +--FILE-- +<?php +require 'server.inc'; + +$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_mlsd($ftp, '.')); + +ftp_close($ftp); +?> +--EXPECTF-- +bool(true) + +Warning: ftp_mlsd(): Missing pathname in MLSD response in %s on line %d + +Warning: ftp_mlsd(): Malformed fact in MLSD response in %s on line %d + +Warning: ftp_mlsd(): Malformed fact in MLSD response in %s on line %d +array(4) { + [0]=> + array(8) { + ["name"]=> + string(1) "." + ["modify"]=> + string(14) "20170127230002" + ["perm"]=> + string(7) "flcdmpe" + ["type"]=> + string(4) "cdir" + ["unique"]=> + string(11) "811U4340002" + ["UNIX.group"]=> + string(2) "33" + ["UNIX.mode"]=> + string(4) "0755" + ["UNIX.owner"]=> + string(2) "33" + } + [1]=> + array(8) { + ["name"]=> + string(2) ".." + ["modify"]=> + string(14) "20170127230002" + ["perm"]=> + string(7) "flcdmpe" + ["type"]=> + string(4) "pdir" + ["unique"]=> + string(11) "811U4340002" + ["UNIX.group"]=> + string(2) "33" + ["UNIX.mode"]=> + string(4) "0755" + ["UNIX.owner"]=> + string(2) "33" + } + [2]=> + array(9) { + ["name"]=> + string(6) "foobar" + ["modify"]=> + string(14) "20170126121225" + ["perm"]=> + string(5) "adfrw" + ["size"]=> + string(4) "4729" + ["type"]=> + string(4) "file" + ["unique"]=> + string(11) "811U4340CB9" + ["UNIX.group"]=> + string(2) "33" + ["UNIX.mode"]=> + string(4) "0644" + ["UNIX.owner"]=> + string(2) "33" + } + [3]=> + array(3) { + ["name"]=> + string(9) "path;name" + ["fact"]=> + string(6) "val=ue" + ["empty"]=> + string(0) "" + } +} diff --git a/ext/ftp/tests/ftp_mlsd_empty_directory.phpt b/ext/ftp/tests/ftp_mlsd_empty_directory.phpt index c9c278a11e..d646d76a98 100644 --- a/ext/ftp/tests/ftp_mlsd_empty_directory.phpt +++ b/ext/ftp/tests/ftp_mlsd_empty_directory.phpt @@ -13,7 +13,6 @@ if (!$ftp) die("Couldn't connect to the server"); var_dump(ftp_login($ftp, 'user', 'pass')); -var_dump(ftp_mlsd($ftp, '')); var_dump(ftp_mlsd($ftp, 'emptydir')); var_dump(ftp_mlsd($ftp, 'bogusdir')); @@ -21,14 +20,6 @@ ftp_close($ftp); ?> --EXPECT-- bool(true) -array(3) { - [0]=> - string(109) "modify=20170127230002;perm=flcdmpe;type=cdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; ." - [1]=> - string(110) "modify=20170127230002;perm=flcdmpe;type=pdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; .." - [2]=> - string(122) "modify=20170126121225;perm=adfrw;size=4729;type=file;unique=811U4340CB9;UNIX.group=33;UNIX.mode=0644;UNIX.owner=33; foobar" -} array(0) { } bool(false) diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index ac2e0a3b63..5f003cc04d 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -489,6 +489,10 @@ if ($pid) { fputs($fs, "modify=20170127230002;perm=flcdmpe;type=cdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; .\r\n"); fputs($fs, "modify=20170127230002;perm=flcdmpe;type=pdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; ..\r\n"); fputs($fs, "modify=20170126121225;perm=adfrw;size=4729;type=file;unique=811U4340CB9;UNIX.group=33;UNIX.mode=0644;UNIX.owner=33; foobar\r\n"); + fputs($fs, "fact=val=ue;empty=; path;name\r\n"); + fputs($fs, "no_space\r\n"); + fputs($fs, "no_semi pathname\r\n"); + fputs($fs, "no_eq; pathname\r\n"); } fputs($s, "226 Closing data Connection.\r\n"); |