File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,26 @@ $file = fopen($path, 'w+');
17
17
// Write over 4GB
18
18
const MIN_FILE_SIZE = 4_294_967_295 ;
19
19
20
- var_dump ( fseek ( $ file , MIN_FILE_SIZE ) );
20
+ $ times_to_seeks = ( int ) ceil ( MIN_FILE_SIZE / PHP_INT_MAX );
21
21
$ 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
+ }
25
40
}
26
41
27
42
$ tidy = new tidy ;
You can’t perform that action at this time.
0 commit comments