]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4' into PHP-8.0
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 2 Dec 2020 10:29:41 +0000 (11:29 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 2 Dec 2020 10:29:41 +0000 (11:29 +0100)
* PHP-7.4:
  Fixed bug #80457

1  2 
ext/standard/streamsfuncs.c

index 1600b997943354bf9c4d175bb1ae17c15bb2f8b5,68ad6483e81fd28098231fba0caff70403240b2a..9ca2def099ed322158d2a612d54303855bf3227d
@@@ -425,15 -425,13 +425,15 @@@ PHP_FUNCTION(stream_get_contents
        ZEND_PARSE_PARAMETERS_START(1, 3)
                Z_PARAM_RESOURCE(zsrc)
                Z_PARAM_OPTIONAL
 -              Z_PARAM_LONG(maxlen)
 +              Z_PARAM_LONG_OR_NULL(maxlen, maxlen_is_null)
                Z_PARAM_LONG(desiredpos)
 -      ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
 +      ZEND_PARSE_PARAMETERS_END();
  
 -      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;
 +      if (maxlen_is_null) {
 +              maxlen = (ssize_t) PHP_STREAM_COPY_ALL;
-       } else if (maxlen < 0 && maxlen != PHP_STREAM_COPY_ALL) {
++      } else if (maxlen < 0 && maxlen != (ssize_t)PHP_STREAM_COPY_ALL) {
 +              zend_argument_value_error(2, "must be greater than or equal to -1");
 +              RETURN_THROWS();
        }
  
        php_stream_from_zval(stream, zsrc);