2
Test vfprintf() function : usage variations - unexpected values for the format argument
5
/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
6
* Description: Write a formatted string to a stream
7
* Source code: ext/standard/formatted_print.c
11
* Test vfprintf() when different unexpected format strings are passed to
12
* the '$format' argument of the function
15
echo "*** Testing vfprintf() : with unexpected values for format argument ***\n";
17
// initialising the required variables
20
//get an unset variable
27
public function __toString() {
33
$file_handle = fopen(__FILE__, 'r');
36
//array of values to iterate over
57
array('color' => 'red', 'item' => 'pen'),
77
/*24*/ @$undefined_var,
86
/* creating dumping file */
87
$data_file = dirname(__FILE__) . '/dump.txt';
88
if (!($fp = fopen($data_file, 'wt')))
91
fprintf($fp, "\n*** Testing vprintf() with with unexpected values for format argument ***\n");
94
foreach( $values as $value ) {
95
fprintf( $fp, "\n-- Iteration %d --\n",$counter);
96
vfprintf($fp, $value, $args);
101
print_r(file_get_contents($data_file));
109
*** Testing vfprintf() : with unexpected values for format argument ***
111
Notice: Array to string conversion in %s on line %d
113
Notice: Array to string conversion in %s on line %d
115
Notice: Array to string conversion in %s on line %d
117
Notice: Array to string conversion in %s on line %d
119
Notice: Array to string conversion in %s on line %d
121
*** Testing vprintf() with with unexpected values for format argument ***