1--TEST-- 2Test vfprintf() function : error conditions (more than expected arguments) 3--CREDITS-- 4Felix De Vliegher <felix.devliegher@gmail.com> 5--INI-- 6precision=14 7--FILE-- 8<?php 9// Open handle 10$file = 'vfprintf_error1.txt'; 11$fp = fopen( $file, "a+" ); 12 13echo "\n-- Testing vfprintf() function with more than expected no. of arguments --\n"; 14$format = 'string_val'; 15$args = array( 1, 2 ); 16$extra_arg = 10; 17try { 18 var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); 19} catch (TypeError $e) { 20 echo $e->getMessage(), "\n"; 21} 22try { 23 var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); 24} catch (TypeError $e) { 25 echo $e->getMessage(), "\n"; 26} 27 28// Close handle 29fclose($fp); 30 31?> 32--CLEAN-- 33<?php 34 35$file = 'vfprintf_error1.txt'; 36unlink( $file ); 37 38?> 39--EXPECT-- 40-- Testing vfprintf() function with more than expected no. of arguments -- 41vfprintf() expects exactly 3 arguments, 4 given 42vfprintf() expects exactly 3 arguments, 4 given 43