1--TEST-- 2Test fread() function : error conditions 3--FILE-- 4<?php 5echo "*** Testing error conditions ***\n"; 6$filename = __FILE__; 7$file_handle = fopen($filename, "r"); 8 9// invalid length argument 10echo "-- Testing fread() with invalid length arguments --\n"; 11$len = 0; 12try { 13 var_dump( fread($file_handle, $len) ); 14} catch (\ValueError $e) { 15 echo $e->getMessage() . \PHP_EOL; 16} 17 18$len = -10; 19try { 20 var_dump( fread($file_handle, $len) ); 21} catch (\ValueError $e) { 22 echo $e->getMessage() . \PHP_EOL; 23} 24 25?> 26--EXPECT-- 27*** Testing error conditions *** 28-- Testing fread() with invalid length arguments -- 29fread(): Argument #2 ($length) must be greater than 0 30fread(): Argument #2 ($length) must be greater than 0 31