mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Fix #80654: file_get_contents() maxlen fails above (2**31)-1 bytes
We remove the arbitrary restriction to `INT_MAX`; it is superfluous on 32bit systems where `ZEND_LONG_MAX == INT_MAX` anyway, and not useful on 64bit systems, where larger files should be readable, if the `memory_limit` is large enough. Closes GH-6648.
This commit is contained in:
parent
217b9e7b41
commit
7e9479083d
4
NEWS
4
NEWS
@ -10,6 +10,10 @@ PHP NEWS
|
||||
semicolon) (cmb)
|
||||
. Fixed bug #70091 (Phar does not mark UTF-8 filenames in ZIP archives). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #80654 (file_get_contents() maxlen fails above (2**31)-1 bytes).
|
||||
(cmb)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #80648 (Fix for bug 79296 should be based on runtime version).
|
||||
(cmb, Remi)
|
||||
|
@ -564,10 +564,6 @@ PHP_FUNCTION(file_get_contents)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (maxlen > INT_MAX) {
|
||||
php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
|
||||
maxlen = INT_MAX;
|
||||
}
|
||||
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) {
|
||||
RETVAL_STR(contents);
|
||||
} else {
|
||||
|
@ -456,10 +456,6 @@ PHP_FUNCTION(stream_get_contents)
|
||||
}
|
||||
}
|
||||
|
||||
if (maxlen > INT_MAX) {
|
||||
php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
|
||||
maxlen = INT_MAX;
|
||||
}
|
||||
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0))) {
|
||||
RETURN_STR(contents);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user