From: helpdesk at dekho-ji dot com Operating system: All PHP version: 5.5.0 Package: Filesystem function related Bug Type: Feature/Change Request Bug description:Allow big-values (float) in size/offset for file open/read/write/seek functions
Description: ------------ Allow big-values (float) in size/offset for file open/read/write/seek functions All file system functions currently are defined with INT params for size/offset/length/bytes flds. Can this be upgraded so that it now accepts long values (floats with 0 decimals). For ex - string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] ) will become string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, FLOAT $offset = -1 [, FLOAT $maxlen ]]]] ) For the end-users, this will be 100% backward compatible and will offer additional func when people specify float values. Simple way to fix this - 1) I believe all file operations use fopen/fseek/fget as their base ? If yes, then these these funcs can be changed to allow float values. Everything will then work smoothly. 2) I currently use fseek SEEK_CUR with 2GB jump offsets and loop it till I finally reach the required BIG offset. It uses simple recursion. 5 lines of code. But if this can be done natively in core system, that will be great benefit for people dealing with huge size files and relevant operations. Test script: --------------- Allow big-values (float) in size/offset for file open/read/write/seek functions All file system functions currently are defined with INT params for size/offset/length/bytes flds. Can this be upgraded so that it now accepts long values (floats with 0 decimals). For ex - string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] ) will become string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, FLOAT $offset = -1 [, FLOAT $maxlen ]]]] ) For the end-users, this will be 100% backward compatible and will offer additional func when people specify float values. Simple way to fix this - 1) I believe all file operations use fopen/fseek/fget as their base ? If yes, then these these funcs can be changed to allow float values. Everything will then work smoothly. 2) I currently use fseek SEEK_CUR with 2GB jump offsets and loop it till I finally reach the required BIG offset. It uses simple recursion. 5 lines of code. But if this can be done natively in core system, that will be great benefit for people dealing with huge size files and relevant operations. Expected result: ---------------- Allow big-values (float) in size/offset for file open/read/write/seek functions All file system functions currently are defined with INT params for size/offset/length/bytes flds. Can this be upgraded so that it now accepts long values (floats with 0 decimals). For ex - string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] ) will become string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, FLOAT $offset = -1 [, FLOAT $maxlen ]]]] ) For the end-users, this will be 100% backward compatible and will offer additional func when people specify float values. Simple way to fix this - 1) I believe all file operations use fopen/fseek/fget as their base ? If yes, then these these funcs can be changed to allow float values. Everything will then work smoothly. 2) I currently use fseek SEEK_CUR with 2GB jump offsets and loop it till I finally reach the required BIG offset. It uses simple recursion. 5 lines of code. But if this can be done natively in core system, that will be great benefit for people dealing with huge size files and relevant operations. Actual result: -------------- All file system functions currently are defined with INT params for size/offset/length/bytes flds. Can this be upgraded so that it now accepts long values (floats with 0 decimals). For ex - string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] ) will become string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, FLOAT $offset = -1 [, FLOAT $maxlen ]]]] ) For the end-users, this will be 100% backward compatible and will offer additional func when people specify float values. Simple way to fix this - 1) I believe all file operations use fopen/fseek/fget as their base ? If yes, then these these funcs can be changed to allow float values. Everything will then work smoothly. 2) I currently use fseek SEEK_CUR with 2GB jump offsets and loop it till I finally reach the required BIG offset. It uses simple recursion. 5 lines of code. But if this can be done natively in core system, that will be great benefit for people dealing with huge size files and relevant operations. -- Edit bug report at https://bugs.php.net/bug.php?id=65222&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65222&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65222&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65222&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65222&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65222&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65222&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65222&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65222&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65222&r=support Expected behavior: https://bugs.php.net/fix.php?id=65222&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65222&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65222&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65222&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65222&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65222&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65222&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65222&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65222&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65222&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65222&r=mysqlcfg