Edit report at https://bugs.php.net/bug.php?id=65222&edit=1
ID: 65222
User updated by: helpdesk at dekho-ji dot com
Reported by: helpdesk at dekho-ji dot com
Summary: Allow big-values (float) in size/offset for file
open/read/write/seek functions
Status: Open
Type: Feature/Change Request
Package: Filesystem function related
Operating System: All
PHP Version: 5.5.0
Block user comment: N
Private report: N
New Comment:
This code DOES NOT work, so ignore it -
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.
Previous Comments:
------------------------------------------------------------------------
[2013-07-09 09:33:41] helpdesk at dekho-ji dot com
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 this bug report at https://bugs.php.net/bug.php?id=65222&edit=1