1--TEST--
2stream_get_contents() with negative max length
3--FILE--
4<?php
5
6$tmp = tmpfile();
7fwrite($tmp, "abcd");
8var_dump(stream_get_contents($tmp, 2, 1));
9
10try {
11    stream_get_contents($tmp, -2);
12} catch (ValueError $exception) {
13    echo $exception->getMessage() . "\n";
14}
15
16?>
17--EXPECT--
18string(2) "bc"
19stream_get_contents(): Argument #2 ($length) must be greater than or equal to -1
20