Browse Source
fix tests after Tony's commit and add a test for the bug he fixed
experimental/5.2-WITH_DRCP
fix tests after Tony's commit and add a test for the bug he fixed
experimental/5.2-WITH_DRCP
5 changed files with 120 additions and 15 deletions
-
22ext/ftp/tests/005.phpt
-
34ext/ftp/tests/bug39583-2.phpt
-
34ext/ftp/tests/bug39583.phpt
-
6ext/ftp/tests/bug7216-2.phpt
-
39ext/ftp/tests/server.inc
@ -0,0 +1,34 @@ |
|||
--TEST-- |
|||
Bug #39583: FTP always transfers in binary mode |
|||
--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')); |
|||
|
|||
$source_file = __FILE__; |
|||
$destination_file = basename(__FILE__); |
|||
|
|||
// upload the file |
|||
$upload = ftp_put($ftp, $destination_file, $source_file, FTP_BINARY); |
|||
|
|||
// check upload status |
|||
if (!$upload) { |
|||
echo "FTP upload has failed!"; |
|||
} else { |
|||
echo "Uploaded $source_file as $destination_file"; |
|||
} |
|||
|
|||
// close the FTP stream |
|||
ftp_close($ftp); |
|||
?> |
|||
--EXPECTF-- |
|||
bool(true) |
|||
Uploaded %sbug39583-2.php as bug39583-2.php |
|||
@ -0,0 +1,34 @@ |
|||
--TEST-- |
|||
Bug #39583: FTP always transfers in binary mode |
|||
--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')); |
|||
|
|||
$source_file = __FILE__; |
|||
$destination_file = basename(__FILE__); |
|||
|
|||
// upload the file |
|||
$upload = ftp_put($ftp, $destination_file, $source_file, FTP_ASCII); |
|||
|
|||
// check upload status |
|||
if (!$upload) { |
|||
echo "FTP upload has failed!"; |
|||
} else { |
|||
echo "Uploaded $source_file as $destination_file"; |
|||
} |
|||
|
|||
// close the FTP stream |
|||
ftp_close($ftp); |
|||
?> |
|||
--EXPECTF-- |
|||
bool(true) |
|||
Uploaded %sbug39583.php as bug39583.php |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue