import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-file / fgetc_error.php
blob802952d061d3fbf076e8dae48f4790760c347dd7
1 <?php
2 /*
3 Prototype: string fgetc ( resource $handle );
4 Description: Gets character from file pointer
5 */
7 echo "*** Testing error conditions ***\n";
8 // zero argument
9 echo "-- Testing fgetc() with zero argument --\n";
10 var_dump( fgetc() );
12 // more than expected no. of args
13 echo "-- Testing fgetc() with more than expected number of arguments --\n";
14 $fp = fopen(__FILE__, "r");
15 var_dump( fgetc($fp, $fp) );
16 fclose($fp);
18 // test invalid arguments : non-resources
19 echo "-- Testing fgetc() with invalid arguments --\n";
20 $invalid_args = array (
21 "string",
22 10,
23 10.5,
24 true,
25 array(1,2,3),
26 new stdclass,
28 /* loop to test fgetc() with different invalid type of args */
29 for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
30 echo "-- Iteration $loop_counter --\n";
31 var_dump( fgetc($invalid_args[$loop_counter - 1]) );
34 echo "Done\n";