Skip to content

Commit eea4aac

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fix #80654: file_get_contents() maxlen fails above (2**31)-1 bytes
2 parents 32dd853 + 766d584 commit eea4aac

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

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)