1--TEST-- 2Test fgets() function : usage variations - closed handle 3--FILE-- 4<?php 5/* try reading a line using fgets() using invalid handles 6 - closed file handle 7 - unset file handle 8*/ 9 10// include the header for common test function 11include ("file.inc"); 12 13echo "*** Testing fgets() : usage variations ***\n"; 14 15echo "-- Testing fgets() with closed handle --\n"; 16// open the file for reading 17$file_handle = fopen(__FILE__, "r"); 18// close the file 19fclose($file_handle); 20 21// read from closed file 22try { 23 var_dump( fgets($file_handle) ); // default length 24} catch (TypeError $e) { 25 echo $e->getMessage(), "\n"; 26} 27try { 28 var_dump( fgets($file_handle, 10) ); // with specific length 29} catch (TypeError $e) { 30 echo $e->getMessage(), "\n"; 31} 32 33echo "Done"; 34?> 35--EXPECT-- 36*** Testing fgets() : usage variations *** 37-- Testing fgets() with closed handle -- 38fgets(): supplied resource is not a valid stream resource 39fgets(): supplied resource is not a valid stream resource 40Done 41