diff options
Diffstat (limited to 'ext/standard/tests/file/fscanf_variation17.phpt')
-rw-r--r-- | ext/standard/tests/file/fscanf_variation17.phpt | 63 |
1 files changed, 19 insertions, 44 deletions
diff --git a/ext/standard/tests/file/fscanf_variation17.phpt b/ext/standard/tests/file/fscanf_variation17.phpt index 4e976c7cb4..64080a1a83 100644 --- a/ext/standard/tests/file/fscanf_variation17.phpt +++ b/ext/standard/tests/file/fscanf_variation17.phpt @@ -3,11 +3,6 @@ Test fscanf() function: usage variations - string formats with arrays --FILE-- <?php -/* - Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] ); - Description: Parses input from a file according to a format -*/ - /* Test fscanf() to scan arrays using different string format types */ $file_path = __DIR__; @@ -46,7 +41,7 @@ $counter = 1; // writing to the file foreach($array_types as $value) { - @fprintf($file_handle, $value); + @fprintf($file_handle, "%s", $value); @fprintf($file_handle, "\n"); } // closing the file @@ -65,7 +60,11 @@ foreach($string_formats as $string_format) { rewind($file_handle); echo "\n-- iteration $counter --\n"; while( !feof($file_handle) ) { - var_dump( fscanf($file_handle,$string_format) ); + try { + var_dump(fscanf($file_handle,$string_format)); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } } $counter++; } @@ -78,7 +77,7 @@ $file_path = __DIR__; $filename = "$file_path/fscanf_variation17.tmp"; unlink($filename); ?> ---EXPECTF-- +--EXPECT-- *** Test fscanf(): different string format types with arrays *** -- iteration 1 -- @@ -388,42 +387,18 @@ array(1) { bool(false) -- iteration 7 -- - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL - -Warning: fscanf(): Bad scan conversion character " " in %s on line %d -NULL +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " bool(false) -- iteration 8 -- |