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);