xref: /php-src/ext/ftp/tests/gh10521.phpt (revision 30141828)
1--TEST--
2GH-10521 (ftp_get/ftp_nb_get resumepos offset is maximum 10GB)
3--EXTENSIONS--
4ftp
5pcntl
6--SKIPIF--
7<?php
8if (PHP_INT_SIZE != 8) die("skip: 64-bit only");
9?>
10--FILE--
11<?php
12require 'server.inc';
13
14$ftp = ftp_connect('127.0.0.1', $port);
15if (!$ftp) die("Couldn't connect to the server");
16
17var_dump(ftp_login($ftp, 'anonymous', 'IEUser@'));
18
19$local_file = __DIR__ . DIRECTORY_SEPARATOR . "gh10521.txt";
20
21foreach ([12345678910, 9223372036854775807] as $size) {
22    $handle = fopen($local_file, 'w');
23    // Doesn't actually succeed in transferring a file. The file transfer gets aborted by our fake server.
24    // We just want to see if the offset was correctly received.
25    ftp_fget($ftp, $handle, 'gh10521', FTP_ASCII, $size);
26    fclose($handle);
27}
28
29?>
30--CLEAN--
31<?php
32@unlink(__DIR__ . DIRECTORY_SEPARATOR . "gh10521.txt");
33?>
34--EXPECTF--
35bool(true)
36
37%s: ftp_fget(): Can't open data connection (12345678910). in %s on line %d
38
39%s: ftp_fget(): Can't open data connection (9223372036854775807). in %s on line %d
40