diff options
Diffstat (limited to 'ext/standard/tests/file/fscanf_variation25.phpt')
-rw-r--r-- | ext/standard/tests/file/fscanf_variation25.phpt | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/ext/standard/tests/file/fscanf_variation25.phpt b/ext/standard/tests/file/fscanf_variation25.phpt index 41d9bdc009..dc9d993602 100644 --- a/ext/standard/tests/file/fscanf_variation25.phpt +++ b/ext/standard/tests/file/fscanf_variation25.phpt @@ -3,11 +3,6 @@ Test fscanf() function: usage variations - char formats with boolean --FILE-- <?php -/* - Prototype: mixed fscanf ( resource $handle, string $format [, mixed &$...] ); - Description: Parses input from a file according to a format -*/ - /* Test fscanf() to scan boolean data using different char format types */ $file_path = __DIR__; @@ -29,10 +24,10 @@ $bool_types = array ( ); $char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); + "%hc", "%lc", "%Lc", + " %c", "%c ", "% c", + "\t%c", "\n%c", "%4c", + "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); $counter = 1; @@ -57,7 +52,11 @@ foreach($char_formats as $char_format) { rewind($file_handle); echo "\n-- iteration $counter --\n"; while( !feof($file_handle) ) { - var_dump( fscanf($file_handle,$char_format) ); + try { + var_dump(fscanf($file_handle,$char_format)); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } } $counter++; } @@ -70,7 +69,7 @@ $file_path = __DIR__; $filename = "$file_path/fscanf_variation25.tmp"; unlink($filename); ?> ---EXPECTF-- +--EXPECT-- *** Test fscanf(): different char format types with boolean data *** -- iteration 1 -- @@ -182,18 +181,10 @@ 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 +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " +Bad scan conversion character " " bool(false) -- iteration 8 -- |