summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-12-02 11:26:10 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-12-02 11:26:10 +0100
commitd6fcaf5da4368918936a875876e0639b7e6f3bd2 (patch)
tree676fdc57d38287414da66abafd2d86e38480cc83
parent685708160e1460d33756f3a04caa6a69491e82d5 (diff)
downloadphp-git-d6fcaf5da4368918936a875876e0639b7e6f3bd2.tar.gz
Fixed bug #80457
On x32 sizeof(size_t) != sizeof(zend_long), so we need to be careful with sign extension here. Patch by bruno dot premont at restena dot lu.
-rw-r--r--NEWS3
-rw-r--r--ext/standard/streamsfuncs.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 05564d1250..ddeb68adfa 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.26
+- Standard:
+ . Fixed bug #80457 (stream_get_contents() fails with maxlength=-1 or default).
+ (bruno dot premont at restena dot lu)
26 Nov 2020, PHP 7.3.25
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 99632a6de8..1a8bd01190 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -442,7 +442,7 @@ PHP_FUNCTION(stream_get_contents)
Z_PARAM_LONG(desiredpos)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
- if (maxlen < 0 && maxlen != PHP_STREAM_COPY_ALL) {
+ if (maxlen < 0 && maxlen != (ssize_t)PHP_STREAM_COPY_ALL) {
php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to zero, or -1");
RETURN_FALSE;
}