|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2021-01-28 16:09 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
[2021-01-28 16:09 UTC] cmb@php.net
[2021-01-28 16:12 UTC] cmb@php.net
[2021-02-01 12:01 UTC] cmb@php.net
[2021-02-01 12:01 UTC] cmb@php.net
-Status: Assigned
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
Description: ------------ when file_get_contents() is instructed to get the first (2**31) bytes of a file that is exactly (2**31) bytes big, php will only fetch the first (2**31)-1 bytes. Test script: --------------- rm -f bug; dd if=/dev/null count=0 bs=1 seek=2147483648 of=bug; php -r 'ini_set("memory_limit","-1");var_dump(strlen(file_get_contents("bug")));'; php -r 'ini_set("memory_limit","-1");var_dump(strlen(file_get_contents("bug", false, null, 0, 2147483648)));'; Expected result: ---------------- int(2147483648) int(2147483648) Actual result: -------------- hansh@LAPTOP-1PLMKU02 ~ $ rm -r bug; dd if=/dev/null count=0 bs=1 seek=2147483648 of=bug ; php -r 'ini_set("memory_limit","-1");var_dump(strlen(file_get_contents("bug")));' 0+0 records in 0+0 records out 0 bytes copied, 0.0023186 s, 0.0 kB/s int(2147483648) hansh@LAPTOP-1PLMKU02 ~ $ rm -r bug; dd if=/dev/null count=0 bs=1 seek=2147483648 of=bug ; php -r 'ini_set("memory_limit","-1");var_dump(strlen(file_get_contents("bug", false, null, 0, 2147483648)));'0+0 records in 0+0 records out 0 bytes copied, 0.0030518 s, 0.0 kB/s PHP Warning: file_get_contents(): maxlen truncated from 2147483648 to 2147483647 bytes in Command line code on line 1 int(2147483647)