From 94a810755fc7cad8e1b61b2c0692279a2228414a Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Thu, 23 Nov 2006 20:47:38 +0000 Subject: [PATCH] add tests for 2 old bugs --- ext/ftp/tests/bug27809.phpt | 21 +++++++++++++++++++++ ext/ftp/tests/bug7216-2.phpt | 21 +++++++++++++++++++++ ext/ftp/tests/bug7216.phpt | 21 +++++++++++++++++++++ ext/ftp/tests/server.inc | 15 +++++++++++++-- 4 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 ext/ftp/tests/bug27809.phpt create mode 100644 ext/ftp/tests/bug7216-2.phpt create mode 100644 ext/ftp/tests/bug7216.phpt diff --git a/ext/ftp/tests/bug27809.phpt b/ext/ftp/tests/bug27809.phpt new file mode 100644 index 00000000000..bcbe03f131d --- /dev/null +++ b/ext/ftp/tests/bug27809.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #27809: ftp_systype returns null +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) +string(6) "OS/400" diff --git a/ext/ftp/tests/bug7216-2.phpt b/ext/ftp/tests/bug7216-2.phpt new file mode 100644 index 00000000000..ce31c45ab59 --- /dev/null +++ b/ext/ftp/tests/bug7216-2.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #7216: ftp_mkdir returns nothing (2) +--SKIPIF-- + +--FILE-- + +--EXPECTREGEX-- +bool\(true\) +string\(\d+\) ".+[\/\\]CVS" diff --git a/ext/ftp/tests/bug7216.phpt b/ext/ftp/tests/bug7216.phpt new file mode 100644 index 00000000000..870e02ea614 --- /dev/null +++ b/ext/ftp/tests/bug7216.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #7216: ftp_mkdir returns nothing +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) +string(3) "CVS" diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index ca42ef8fdaf..37df7933752 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -151,7 +151,11 @@ while($buf = fread($s, 4098)) { fputs($s, "250 CDUP command successful.\r\n"); } elseif ($buf === "SYST\r\n") { - fputs($s, "215 UNIX Type: L8.\r\n"); + if (isset($bug27809)) { + fputs($s, "215 OS/400 is the remote operating system. The TCP/IP version is \"V5R2M0\"\r\n"); + } else { + fputs($s, "215 UNIX Type: L8.\r\n"); + } } elseif ($buf === "QUIT\r\n") { break; @@ -160,7 +164,14 @@ while($buf = fread($s, 4098)) { change_dir($m[1]); fputs($s, "250 CWD command successful.\r\n"); - } else if(preg_match('/^USER /', $buf)) { + } elseif (preg_match("~^MKD ([A-Za-z./]+)\r\n$~", $buf, $m)) { + if (isset($bug7216)) { + fputs($s, "257 OK.\r\n"); + } else { + fputs($s, '257 "'.realpath($m[1])."\" created.\r\n"); + } + + } elseif (preg_match('/^USER /', $buf)) { user_auth($buf); } else {