forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgh10521.phpt
39 lines (32 loc) · 1019 Bytes
/
gh10521.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--TEST--
GH-10521 (ftp_get/ftp_nb_get resumepos offset is maximum 10GB)
--EXTENSIONS--
ftp
pcntl
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8) die("skip: 64-bit only");
?>
--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@'));
$local_file = __DIR__ . DIRECTORY_SEPARATOR . "gh10521.txt";
foreach ([12345678910, 9223372036854775807] as $size) {
$handle = fopen($local_file, 'w');
// Doesn't actually succeed in transferring a file. The file transfer gets aborted by our fake server.
// We just want to see if the offset was correctly received.
ftp_fget($ftp, $handle, 'gh10521', FTP_ASCII, $size);
fclose($handle);
}
?>
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . "gh10521.txt");
?>
--EXPECTF--
bool(true)
%s: ftp_fget(): Can't open data connection (12345678910). in %s on line %d
%s: ftp_fget(): Can't open data connection (9223372036854775807). in %s on line %d