1--TEST--
2SplFileObject::fread function
3--FILE--
4<?php
5$obj = new SplFileObject(__FILE__, 'r');
6$data = $obj->fread(5);
7var_dump($data);
8
9try {
10    $data = $obj->fread(0);
11    var_dump($data);
12} catch (\ValueError $e) {
13    echo $e->getMessage() . \PHP_EOL;
14}
15
16// read more data than is available
17$data = $obj->fread(filesize(__FILE__) + 32);
18var_dump(strlen($data) === filesize(__FILE__) - 5);
19
20?>
21--EXPECT--
22string(5) "<?php"
23SplFileObject::fread(): Argument #1 ($length) must be greater than 0
24bool(true)
25