Skip to content

Commit 766d584

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #80654: file_get_contents() maxlen fails above (2**31)-1 bytes
2 parents cab1ea4 + 7e94790 commit 766d584

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

NEWS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ PHP NEWS
1111
preloaded JITted code). (Dmitry)
1212
. Fixed bug #80682 (opcache doesn't honour pcre.jit option). (Remi)
1313

14-
1514
- Phar:
1615
. Fixed bug #75850 (Unclear error message wrt. __halt_compiler() w/o
1716
semicolon) (cmb)
1817
. Fixed bug #70091 (Phar does not mark UTF-8 filenames in ZIP archives). (cmb)
1918

19+
- Standard:
20+
. Fixed bug #80654 (file_get_contents() maxlen fails above (2**31)-1 bytes).
21+
(cmb)
22+
2023
21 Jan 2021, PHP 8.0.2
2124

2225
- Core:

ext/standard/file.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,6 @@ PHP_FUNCTION(file_get_contents)
564564
RETURN_FALSE;
565565
}
566566

567-
if (maxlen > INT_MAX) {
568-
php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
569-
maxlen = INT_MAX;
570-
}
571567
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) {
572568
RETVAL_STR(contents);
573569
} else {

ext/standard/streamsfuncs.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,6 @@ PHP_FUNCTION(stream_get_contents)
458458
}
459459
}
460460

461-
if (maxlen > INT_MAX) {
462-
php_error_docref(NULL, E_WARNING, "Argument #2 ($maxlength) is truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
463-
maxlen = INT_MAX;
464-
}
465461
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0))) {
466462
RETURN_STR(contents);
467463
} else {

0 commit comments

Comments
 (0)