summaryrefslogtreecommitdiff
path: root/ext/standard/streamsfuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/streamsfuncs.c')
-rw-r--r--ext/standard/streamsfuncs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 493f3d0864..99632a6de8 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -442,6 +442,11 @@ PHP_FUNCTION(stream_get_contents)
Z_PARAM_LONG(desiredpos)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ if (maxlen < 0 && maxlen != PHP_STREAM_COPY_ALL) {
+ php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to zero, or -1");
+ RETURN_FALSE;
+ }
+
php_stream_from_zval(stream, zsrc);
if (desiredpos >= 0) {