Closed
Description
Description
The following cmd.exe invocation:
php -r "ini_set('memory_limit', '6G'); $size = 5 * 1024 * 1024 * 1024; $str = str_repeat(\"\x00\", $size); file_put_contents('test.bin', $str);"
dir
Resulted in this output:
C:\reproduce>php -r "ini_set('memory_limit', '6G'); $size = 5 * 1024 * 1024 * 1024; $str = str_repeat(\"\x00\", $size); file_put_contents('test.bin', $str);"
PHP Notice: file_put_contents(): Write of 4294967295 bytes failed with errno=0 No error in Command line code on line 1
Notice: file_put_contents(): Write of 4294967295 bytes failed with errno=0 No error in Command line code on line 1
C:\reproduce>dir
Volume in drive C has no label.
Volume Serial Number is 445C-1EDF
Directory of C:\reproduce
20/01/2024 18:41 <DIR> .
20/01/2024 18:41 <DIR> ..
20/01/2024 18:41 4,294,967,295 test.bin
1 File(s) 4,294,967,295 bytes
2 Dir(s) 2,580,218,351,616 bytes free
But I expected this output instead:
C:\reproduce>php -r "ini_set('memory_limit', '6G'); $size = 5 * 1024 * 1024 * 1024; $str = str_repeat(\"\x00\", $size); file_put_contents('test.bin', $str);"
C:\reproduce>dir
Volume in drive C has no label.
Volume Serial Number is 445C-1EDF
Directory of C:\reproduce
20/01/2024 18:41 <DIR> .
20/01/2024 18:41 <DIR> ..
20/01/2024 18:41 5,368,709,120 test.bin
1 File(s) 5,368,709,120 bytes
2 Dir(s) 2,580,218,351,616 bytes free
- tested on both 8.3.2 and 8.3.0
- interestingly, it does /not/ reproduce on Linux.
PHP Version
PHP 8.3.2
Operating System
Windows 10 x64 22H2