mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
add tests for 2 old bugs
This commit is contained in:
parent
7172a53c3a
commit
94a810755f
21
ext/ftp/tests/bug27809.phpt
Normal file
21
ext/ftp/tests/bug27809.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #27809: ftp_systype returns null
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$bug27809=true;
|
||||
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, 'anonymous', 'IEUser@'));
|
||||
var_dump(ftp_systype($ftp));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
string(6) "OS/400"
|
21
ext/ftp/tests/bug7216-2.phpt
Normal file
21
ext/ftp/tests/bug7216-2.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #7216: ftp_mkdir returns nothing (2)
|
||||
--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, 'anonymous', 'IEUser@'));
|
||||
// test for the correct behavior this time
|
||||
var_dump(ftp_mkdir($ftp, 'CVS'));
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
bool\(true\)
|
||||
string\(\d+\) ".+[\/\\]CVS"
|
21
ext/ftp/tests/bug7216.phpt
Normal file
21
ext/ftp/tests/bug7216.phpt
Normal file
@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #7216: ftp_mkdir returns nothing
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$bug7216=true;
|
||||
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, 'anonymous', 'IEUser@'));
|
||||
var_dump(ftp_mkdir($ftp, 'CVS'));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
string(3) "CVS"
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user