Skip to content

Commit ca67517

Browse files
committed
Attempt to run test properly on 32 bits
1 parent c331c3b commit ca67517

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

ext/tidy/tests/parsing_file_too_large.phpt

+19-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,26 @@ $file = fopen($path, 'w+');
1717
// Write over 4GB
1818
const MIN_FILE_SIZE = 4_294_967_295;
1919

20-
var_dump(fseek($file, MIN_FILE_SIZE));
20+
$times_to_seeks = (int)ceil(MIN_FILE_SIZE/PHP_INT_MAX);
2121
$s = str_repeat("a", 10);
22-
$bytes_written = fwrite($file, $s);
23-
if ($bytes_written === false) {
24-
echo "Didn't write bytes\n";
22+
23+
/* 64 bits */
24+
if ($times_to_seeks === 1) {
25+
var_dump(fseek($file, MIN_FILE_SIZE));
26+
$bytes_written = fwrite($file, $s);
27+
if ($bytes_written === false) {
28+
echo "Didn't write bytes\n";
29+
}
30+
} else {
31+
$seekStatus = 0;
32+
for ($i = 1; $i < $times_to_seeks; ++$i) {
33+
$seekStatus += fseek($file, PHP_INT_MAX, SEEK_CUR);
34+
}
35+
var_dump($seekStatus);
36+
$bytes_written = fwrite($file, $s);
37+
if ($bytes_written === false) {
38+
echo "Didn't write bytes\n";
39+
}
2540
}
2641

2742
$tidy = new tidy;

0 commit comments

Comments
 (0)