From 570c2eb54d277f7c34e8570330f73ec45537bf40 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 11 Dec 2025 17:41:26 +0000 Subject: [PATCH 01/31] ext/standard: Delete fscanf test cases that write arrays to file via fprintf --- .../tests/file/fscanf_variation11.phpt | 687 ------------------ .../tests/file/fscanf_variation17.phpt | 686 ----------------- .../tests/file/fscanf_variation23.phpt | 686 ----------------- .../tests/file/fscanf_variation30.phpt | 687 ------------------ .../tests/file/fscanf_variation36.phpt | 682 ----------------- .../tests/file/fscanf_variation42.phpt | 682 ----------------- .../tests/file/fscanf_variation48.phpt | 682 ----------------- .../tests/file/fscanf_variation5.phpt | 682 ----------------- 8 files changed, 5474 deletions(-) delete mode 100644 ext/standard/tests/file/fscanf_variation11.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation17.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation23.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation30.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation36.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation42.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation48.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation5.phpt diff --git a/ext/standard/tests/file/fscanf_variation11.phpt b/ext/standard/tests/file/fscanf_variation11.phpt deleted file mode 100644 index 40560cfb39d91..0000000000000 --- a/ext/standard/tests/file/fscanf_variation11.phpt +++ /dev/null @@ -1,687 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - float formats with arrays ---FILE-- - "One", "two" => 2) -); - -$float_formats = array( "%f", - "%hf", "%lf", "%Lf", - " %f", "%f ", "% f", - "\t%f", "\n%f", "%4f", - "%30f", "%[0-9]", "%*f" - ); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different float formats -foreach($float_formats as $float_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$float_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different float format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -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 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation17.phpt b/ext/standard/tests/file/fscanf_variation17.phpt deleted file mode 100644 index 64080a1a83b95..0000000000000 --- a/ext/standard/tests/file/fscanf_variation17.phpt +++ /dev/null @@ -1,686 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - string formats with arrays ---FILE-- - "One", "two" => 2) -); - -$string_formats = array( "%s", - "%hs", "%ls", "%Ls", - " %s", "%s ", "% s", - "\t%s", "\n%s", "%4s", - "%30s", "%[a-zA-Z0-9]", "%*s"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different string formats -foreach($string_formats as $string_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$string_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different string format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 7 -- -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 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation23.phpt b/ext/standard/tests/file/fscanf_variation23.phpt deleted file mode 100644 index f7bb4ee552011..0000000000000 --- a/ext/standard/tests/file/fscanf_variation23.phpt +++ /dev/null @@ -1,686 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - char formats with arrays ---FILE-- - "One", "two" => 2) -); - -$char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different char formats -foreach($char_formats as $char_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$char_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different char format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 7 -- -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 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation30.phpt b/ext/standard/tests/file/fscanf_variation30.phpt deleted file mode 100644 index 9afde0f093aca..0000000000000 --- a/ext/standard/tests/file/fscanf_variation30.phpt +++ /dev/null @@ -1,687 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - octal formats with arrays ---FILE-- - "One", "two" => 2) -); - -$octal_formats = array ( "%o", - "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", - "\t%o", "\n%o", "%4o", - "%30o", "%[0-7]", "%*o" - ); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different octal formats -foreach($octal_formats as $octal_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$octal_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different octal format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -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 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation36.phpt b/ext/standard/tests/file/fscanf_variation36.phpt deleted file mode 100644 index 61571f6c6cb04..0000000000000 --- a/ext/standard/tests/file/fscanf_variation36.phpt +++ /dev/null @@ -1,682 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - hexa formats with arrays ---FILE-- - "One", "two" => 2) -); - -$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "% x", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different hexa formats -foreach($hexa_formats as $hexa_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$hexa_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different hexa format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 7 -- -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 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation42.phpt b/ext/standard/tests/file/fscanf_variation42.phpt deleted file mode 100644 index 90436ff124900..0000000000000 --- a/ext/standard/tests/file/fscanf_variation42.phpt +++ /dev/null @@ -1,682 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - unsigned formats with arrays ---FILE-- - "One", "two" => 2) -); - -$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different unsigned formats -foreach($unsigned_formats as $unsigned_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$unsigned_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different unsigned format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -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 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation48.phpt b/ext/standard/tests/file/fscanf_variation48.phpt deleted file mode 100644 index aa717bd83e0de..0000000000000 --- a/ext/standard/tests/file/fscanf_variation48.phpt +++ /dev/null @@ -1,682 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - scientific formats with arrays ---FILE-- - "One", "two" => 2) -); - -$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different scientific formats -foreach($scientific_formats as $scientific_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$scientific_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different scientific format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -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 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation5.phpt b/ext/standard/tests/file/fscanf_variation5.phpt deleted file mode 100644 index 7ccdbf6402e49..0000000000000 --- a/ext/standard/tests/file/fscanf_variation5.phpt +++ /dev/null @@ -1,682 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - integer formats with arrays ---FILE-- - "One", "two" => 2) -); - -$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different integer formats -foreach($int_formats as $int_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$int_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different integer format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -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 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** From a7dff9c2eb697fa23e75ae4ae36d0faa8b336776 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 11 Dec 2025 17:46:18 +0000 Subject: [PATCH 02/31] ext/standard: Delete fscanf test cases that write resources to file via fprintf --- .../tests/file/fscanf_variation10.phpt | 216 ------------------ .../tests/file/fscanf_variation16.phpt | 215 ----------------- .../tests/file/fscanf_variation22.phpt | 215 ----------------- .../tests/file/fscanf_variation29.phpt | 216 ------------------ .../tests/file/fscanf_variation35.phpt | 211 ----------------- .../tests/file/fscanf_variation4.phpt | 212 ----------------- .../tests/file/fscanf_variation41.phpt | 211 ----------------- .../tests/file/fscanf_variation47.phpt | 211 ----------------- 8 files changed, 1707 deletions(-) delete mode 100644 ext/standard/tests/file/fscanf_variation10.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation16.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation22.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation29.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation35.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation4.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation41.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation47.phpt diff --git a/ext/standard/tests/file/fscanf_variation10.phpt b/ext/standard/tests/file/fscanf_variation10.phpt deleted file mode 100644 index 1de7d25ffd90f..0000000000000 --- a/ext/standard/tests/file/fscanf_variation10.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - float formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different float format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation16.phpt b/ext/standard/tests/file/fscanf_variation16.phpt deleted file mode 100644 index 199db82a026e8..0000000000000 --- a/ext/standard/tests/file/fscanf_variation16.phpt +++ /dev/null @@ -1,215 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - string formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different string format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(4) "Reso" -} -array(1) { - [0]=> - string(4) "Reso" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation22.phpt b/ext/standard/tests/file/fscanf_variation22.phpt deleted file mode 100644 index 87a5fe21bc27a..0000000000000 --- a/ext/standard/tests/file/fscanf_variation22.phpt +++ /dev/null @@ -1,215 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - char formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different char format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(4) "Reso" -} -array(1) { - [0]=> - string(4) "Reso" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation29.phpt b/ext/standard/tests/file/fscanf_variation29.phpt deleted file mode 100644 index a35d782fcd456..0000000000000 --- a/ext/standard/tests/file/fscanf_variation29.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - octal formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different octal format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation35.phpt b/ext/standard/tests/file/fscanf_variation35.phpt deleted file mode 100644 index 61b939d32122d..0000000000000 --- a/ext/standard/tests/file/fscanf_variation35.phpt +++ /dev/null @@ -1,211 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - hexa formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different hexa format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation4.phpt b/ext/standard/tests/file/fscanf_variation4.phpt deleted file mode 100644 index 45a3b5702b1f6..0000000000000 --- a/ext/standard/tests/file/fscanf_variation4.phpt +++ /dev/null @@ -1,212 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - integer formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different integer format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation41.phpt b/ext/standard/tests/file/fscanf_variation41.phpt deleted file mode 100644 index 4c993bbeec5a9..0000000000000 --- a/ext/standard/tests/file/fscanf_variation41.phpt +++ /dev/null @@ -1,211 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - unsigned formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different unsigned format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation47.phpt b/ext/standard/tests/file/fscanf_variation47.phpt deleted file mode 100644 index 04b92b7e9f786..0000000000000 --- a/ext/standard/tests/file/fscanf_variation47.phpt +++ /dev/null @@ -1,211 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - scientific formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different scientific format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** From ec67bbd544650fc780d9c22df2f1e48421919644 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 11 Dec 2025 17:46:35 +0000 Subject: [PATCH 03/31] ext/standard: Delete fscanf test cases that write objects to file via fprintf --- .../tests/file/fscanf_variation54.phpt | 95 ------------------- 1 file changed, 95 deletions(-) delete mode 100644 ext/standard/tests/file/fscanf_variation54.phpt diff --git a/ext/standard/tests/file/fscanf_variation54.phpt b/ext/standard/tests/file/fscanf_variation54.phpt deleted file mode 100644 index b13a4ee1b83d2..0000000000000 --- a/ext/standard/tests/file/fscanf_variation54.phpt +++ /dev/null @@ -1,95 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - objects ---FILE-- - ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): to read objects from a file *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(6) "Object" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} - -*** Done *** From e0378f6694b8eb370b717cde0b1fd58eb413c3ba Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 11 Dec 2025 17:51:52 +0000 Subject: [PATCH 04/31] ext/standard: Delete fscanf test cases that write bools to file via fprintf This effectively tests scanning an empty file line or a file line only containing '1', which is already handled by the string tests --- .../tests/file/fscanf_variation13.phpt | 236 --------------- .../tests/file/fscanf_variation19.phpt | 240 --------------- .../tests/file/fscanf_variation25.phpt | 284 ------------------ .../tests/file/fscanf_variation32.phpt | 241 --------------- .../tests/file/fscanf_variation38.phpt | 236 --------------- .../tests/file/fscanf_variation44.phpt | 236 --------------- .../tests/file/fscanf_variation50.phpt | 236 --------------- .../tests/file/fscanf_variation7.phpt | 236 --------------- 8 files changed, 1945 deletions(-) delete mode 100644 ext/standard/tests/file/fscanf_variation13.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation19.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation25.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation32.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation38.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation44.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation50.phpt delete mode 100644 ext/standard/tests/file/fscanf_variation7.phpt diff --git a/ext/standard/tests/file/fscanf_variation13.phpt b/ext/standard/tests/file/fscanf_variation13.phpt deleted file mode 100644 index 73806dc6e488b..0000000000000 --- a/ext/standard/tests/file/fscanf_variation13.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - float formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different float format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation19.phpt b/ext/standard/tests/file/fscanf_variation19.phpt deleted file mode 100644 index f5bc3f19e386c..0000000000000 --- a/ext/standard/tests/file/fscanf_variation19.phpt +++ /dev/null @@ -1,240 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - string formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different string format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation25.phpt b/ext/standard/tests/file/fscanf_variation25.phpt deleted file mode 100644 index dc9d9936022fb..0000000000000 --- a/ext/standard/tests/file/fscanf_variation25.phpt +++ /dev/null @@ -1,284 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - char formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different char format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation32.phpt b/ext/standard/tests/file/fscanf_variation32.phpt deleted file mode 100644 index df393f9d83980..0000000000000 --- a/ext/standard/tests/file/fscanf_variation32.phpt +++ /dev/null @@ -1,241 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - octal formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different octal format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation38.phpt b/ext/standard/tests/file/fscanf_variation38.phpt deleted file mode 100644 index 236d547f6b786..0000000000000 --- a/ext/standard/tests/file/fscanf_variation38.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - hexa formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different hexa format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation44.phpt b/ext/standard/tests/file/fscanf_variation44.phpt deleted file mode 100644 index 3dfd5d6d7bdaf..0000000000000 --- a/ext/standard/tests/file/fscanf_variation44.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - unsigned formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different unsigned format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation50.phpt b/ext/standard/tests/file/fscanf_variation50.phpt deleted file mode 100644 index 1e6ecb865e940..0000000000000 --- a/ext/standard/tests/file/fscanf_variation50.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - scientific formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different scientific format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation7.phpt b/ext/standard/tests/file/fscanf_variation7.phpt deleted file mode 100644 index 42e2455eea801..0000000000000 --- a/ext/standard/tests/file/fscanf_variation7.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - integer formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different integer format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** From 2f13db4dccb5f44303b4afc1a8294091aacb680d Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 11 Dec 2025 17:40:37 +0000 Subject: [PATCH 05/31] ext/standard: Remove invalid specifier tests for fscanf These are not parsing related --- .../tests/file/fscanf_variation12.phpt | 431 +---------------- .../tests/file/fscanf_variation14.phpt | 39 +- .../tests/file/fscanf_variation15.phpt | 30 +- .../tests/file/fscanf_variation18.phpt | 33 +- .../tests/file/fscanf_variation2.phpt | 35 +- .../tests/file/fscanf_variation20.phpt | 33 +- .../tests/file/fscanf_variation21.phpt | 30 +- .../tests/file/fscanf_variation24.phpt | 453 +----------------- .../tests/file/fscanf_variation26.phpt | 20 +- .../tests/file/fscanf_variation27.phpt | 33 +- .../tests/file/fscanf_variation28.phpt | 30 +- .../tests/file/fscanf_variation3.phpt | 30 +- .../tests/file/fscanf_variation31.phpt | 431 +---------------- .../tests/file/fscanf_variation33.phpt | 33 +- .../tests/file/fscanf_variation34.phpt | 30 +- .../tests/file/fscanf_variation37.phpt | 431 +---------------- .../tests/file/fscanf_variation39.phpt | 33 +- .../tests/file/fscanf_variation40.phpt | 30 +- .../tests/file/fscanf_variation43.phpt | 431 +---------------- .../tests/file/fscanf_variation45.phpt | 33 +- .../tests/file/fscanf_variation46.phpt | 30 +- .../tests/file/fscanf_variation49.phpt | 431 +---------------- .../tests/file/fscanf_variation6.phpt | 431 +---------------- .../tests/file/fscanf_variation8.phpt | 45 +- .../tests/file/fscanf_variation9.phpt | 33 +- 25 files changed, 172 insertions(+), 3447 deletions(-) diff --git a/ext/standard/tests/file/fscanf_variation12.phpt b/ext/standard/tests/file/fscanf_variation12.phpt index 0969d05febced..4fb845845b309 100644 --- a/ext/standard/tests/file/fscanf_variation12.phpt +++ b/ext/standard/tests/file/fscanf_variation12.phpt @@ -16,28 +16,19 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; -$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "% f", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f"); +$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f"); $counter = 1; @@ -84,11 +75,6 @@ unlink($filename); -- iteration 1 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -97,34 +83,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -153,11 +111,6 @@ bool(false) -- iteration 2 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -166,34 +119,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -222,11 +147,6 @@ bool(false) -- iteration 3 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -235,34 +155,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -291,11 +183,6 @@ bool(false) -- iteration 4 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -304,34 +191,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -360,11 +219,6 @@ bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -373,34 +227,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -429,11 +255,6 @@ bool(false) -- iteration 6 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -442,34 +263,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -497,41 +290,11 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- -NULL NULL array(1) { [0]=> float(0) } -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} array(1) { [0]=> float(1) @@ -560,47 +323,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> float(0) } -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} array(1) { [0]=> float(1) @@ -629,47 +359,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 10 -- -NULL +-- iteration 9 -- NULL array(1) { [0]=> float(0) } -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} array(1) { [0]=> float(1) @@ -698,47 +395,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 11 -- -NULL +-- iteration 10 -- NULL array(1) { [0]=> float(0) } -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} array(1) { [0]=> float(1) @@ -767,37 +431,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -806,14 +442,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -842,34 +470,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 13 -- -NULL +-- iteration 12 -- NULL array(0) { } @@ -887,22 +490,6 @@ array(0) { } array(0) { } -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} bool(false) *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation14.phpt b/ext/standard/tests/file/fscanf_variation14.phpt index 97a07a98f2e19..05baaad582e92 100644 --- a/ext/standard/tests/file/fscanf_variation14.phpt +++ b/ext/standard/tests/file/fscanf_variation14.phpt @@ -62,7 +62,7 @@ $valid_strings = array( // various string formats $string_formats = array( "%s", "%hs", "%ls", "%Ls", - " %s", "%s ", "% s", + " %s", "%s ", "\t%s", "\n%s", "%4s", "%30s", "%[a-zA-Z0-9]", "%*s" ); @@ -565,33 +565,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- NULL NULL NULL @@ -666,7 +639,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- NULL NULL NULL @@ -741,7 +714,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- NULL NULL NULL @@ -816,7 +789,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- NULL NULL NULL @@ -891,7 +864,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -987,7 +960,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- NULL NULL NULL diff --git a/ext/standard/tests/file/fscanf_variation15.phpt b/ext/standard/tests/file/fscanf_variation15.phpt index b35bb1bebe253..d5f561033af82 100644 --- a/ext/standard/tests/file/fscanf_variation15.phpt +++ b/ext/standard/tests/file/fscanf_variation15.phpt @@ -37,7 +37,7 @@ $float_values = array ( $string_formats = array( "%s", "%hs", "%ls", "%Ls", - " %s", "%s ", "% s", + " %s", "%s ", "\t%s", "\n%s", "%4s", "%30s", "%[a-zA-Z0-9]", "%*s"); @@ -463,24 +463,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> string(11) "-2147483649" @@ -543,7 +525,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(11) "-2147483649" @@ -606,7 +588,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(4) "-214" @@ -669,7 +651,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(11) "-2147483649" @@ -732,7 +714,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -795,7 +777,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation18.phpt b/ext/standard/tests/file/fscanf_variation18.phpt index eef94173c5838..7e78aa83de461 100644 --- a/ext/standard/tests/file/fscanf_variation18.phpt +++ b/ext/standard/tests/file/fscanf_variation18.phpt @@ -40,7 +40,7 @@ $integer_values = array ( $string_formats = array( "%s", "%hs", "%ls", "%Ls", - " %s", "%s ", "% s", + " %s", "%s ", "\t%s", "\n%s", "%4s", "%30s", "%[a-zA-Z0-9]", "%*s" ); @@ -539,27 +539,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- array(1) { [0]=> string(1) "0" @@ -634,7 +613,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(1) "0" @@ -709,7 +688,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(1) "0" @@ -784,7 +763,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(1) "0" @@ -859,7 +838,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -934,7 +913,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation2.phpt b/ext/standard/tests/file/fscanf_variation2.phpt index f2c5593c3ee6a..b00064675aca2 100644 --- a/ext/standard/tests/file/fscanf_variation2.phpt +++ b/ext/standard/tests/file/fscanf_variation2.phpt @@ -32,12 +32,12 @@ $valid_ints = array( 0x7fffffff, // max positive integer as hexadecimal 0x7FFFFFFF, // max positive integer as hexadecimal 0123, // integer as octal - 01, // should be quivalent to octal 1 + 01, // should be equivalent to octal 1 -020000000000, // max negative integer as octal 017777777777 // max positive integer as octal ); // various integer formats -$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); +$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); $counter = 1; @@ -533,27 +533,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- array(1) { [0]=> int(0) @@ -628,7 +607,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(0) @@ -703,7 +682,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(0) @@ -778,7 +757,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(0) @@ -853,7 +832,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -928,7 +907,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation20.phpt b/ext/standard/tests/file/fscanf_variation20.phpt index 70b13dd55c906..69d9f3a374cba 100644 --- a/ext/standard/tests/file/fscanf_variation20.phpt +++ b/ext/standard/tests/file/fscanf_variation20.phpt @@ -39,7 +39,7 @@ $valid_ints = array( // various char formats $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", + " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-bA-B@#$&]", "%*c"); @@ -537,27 +537,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- array(1) { [0]=> string(1) "0" @@ -632,7 +611,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(1) "0" @@ -707,7 +686,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(1) "0" @@ -782,7 +761,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(1) "0" @@ -857,7 +836,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -932,7 +911,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation21.phpt b/ext/standard/tests/file/fscanf_variation21.phpt index 86968ddd1177e..3f318e318ee14 100644 --- a/ext/standard/tests/file/fscanf_variation21.phpt +++ b/ext/standard/tests/file/fscanf_variation21.phpt @@ -37,7 +37,7 @@ $float_values = array ( $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", + " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); @@ -463,24 +463,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> string(1) "-" @@ -543,7 +525,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(1) "-" @@ -606,7 +588,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(4) "-214" @@ -669,7 +651,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(11) "-2147483649" @@ -732,7 +714,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -795,7 +777,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation24.phpt b/ext/standard/tests/file/fscanf_variation24.phpt index 4c46cf58dad11..481946ed0d6e6 100644 --- a/ext/standard/tests/file/fscanf_variation24.phpt +++ b/ext/standard/tests/file/fscanf_variation24.phpt @@ -16,30 +16,21 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", + " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); @@ -91,14 +82,6 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -107,10 +90,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "" @@ -119,18 +98,6 @@ array(1) { [0]=> string(1) "\" } -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "s" @@ -139,22 +106,10 @@ array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -166,14 +121,6 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -182,18 +129,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} array(1) { [0]=> string(1) "" @@ -206,30 +141,14 @@ array(1) { [0]=> string(1) "s" } -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -241,14 +160,6 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -257,18 +168,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} array(1) { [0]=> string(1) "" @@ -281,30 +180,14 @@ array(1) { [0]=> string(1) "s" } -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -316,14 +199,6 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -332,18 +207,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} array(1) { [0]=> string(1) "" @@ -356,30 +219,14 @@ array(1) { [0]=> string(1) "s" } -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -388,11 +235,6 @@ bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -401,10 +243,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "" @@ -413,18 +251,6 @@ array(1) { [0]=> string(1) "\" } -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "s" @@ -433,22 +259,10 @@ array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -460,22 +274,10 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -488,18 +290,6 @@ array(1) { [0]=> string(1) "\" } -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "s" @@ -508,22 +298,10 @@ array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -531,53 +309,15 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- -NULL NULL array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} array(1) { [0]=> string(1) "" @@ -590,51 +330,26 @@ array(1) { [0]=> string(1) "s" } -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" } bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -647,18 +362,6 @@ array(1) { [0]=> string(1) "\" } -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "s" @@ -667,33 +370,17 @@ array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" } bool(false) --- iteration 10 -- -array(1) { - [0]=> - string(0) "" -} +-- iteration 9 -- array(1) { [0]=> string(0) "" @@ -702,14 +389,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -718,14 +397,6 @@ array(1) { [0]=> string(1) "" } -array(1) { - [0]=> - string(4) "\x01" -} -array(1) { - [0]=> - string(1) "" -} array(1) { [0]=> string(3) "\01" @@ -734,41 +405,21 @@ array(1) { [0]=> string(4) "stri" } -array(1) { - [0]=> - string(4) "stri" -} array(1) { [0]=> string(4) "true" } -array(1) { - [0]=> - string(4) "FALS" -} array(1) { [0]=> string(4) "fals" } -array(1) { - [0]=> - string(4) "TRUE" -} -array(1) { - [0]=> - string(4) "NULL" -} array(1) { [0]=> string(4) "null" } bool(false) --- iteration 11 -- -array(1) { - [0]=> - string(0) "" -} +-- iteration 10 -- array(1) { [0]=> string(0) "" @@ -777,14 +428,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -793,14 +436,6 @@ array(1) { [0]=> string(1) "" } -array(1) { - [0]=> - string(4) "\x01" -} -array(1) { - [0]=> - string(1) "" -} array(1) { [0]=> string(3) "\01" @@ -809,41 +444,21 @@ array(1) { [0]=> string(6) "string" } -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(4) "true" } -array(1) { - [0]=> - string(5) "FALSE" -} array(1) { [0]=> string(5) "false" } -array(1) { - [0]=> - string(4) "TRUE" -} -array(1) { - [0]=> - string(4) "NULL" -} array(1) { [0]=> string(4) "null" } bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -852,14 +467,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -872,18 +479,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -892,47 +487,17 @@ array(1) { [0]=> string(4) "true" } -array(1) { - [0]=> - string(5) "FALSE" -} array(1) { [0]=> string(5) "false" } -array(1) { - [0]=> - string(4) "TRUE" -} -array(1) { - [0]=> - string(4) "NULL" -} array(1) { [0]=> string(4) "null" } bool(false) --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation26.phpt b/ext/standard/tests/file/fscanf_variation26.phpt index 19db8f45abfdd..d023daf507a34 100644 --- a/ext/standard/tests/file/fscanf_variation26.phpt +++ b/ext/standard/tests/file/fscanf_variation26.phpt @@ -20,7 +20,7 @@ $char_types = array( 'a', "a", 67, -67, 99 ); $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", + " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); @@ -206,14 +206,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> string(1) "a" @@ -236,7 +228,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(1) "a" @@ -259,7 +251,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(1) "a" @@ -282,7 +274,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(1) "a" @@ -305,7 +297,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "a" @@ -328,7 +320,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation27.phpt b/ext/standard/tests/file/fscanf_variation27.phpt index a9560e042505c..0b1854c758dec 100644 --- a/ext/standard/tests/file/fscanf_variation27.phpt +++ b/ext/standard/tests/file/fscanf_variation27.phpt @@ -39,7 +39,7 @@ $valid_ints = array( // various octal formats $octal_formats = array( "%o", "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", + " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-7]", "%*o" ); @@ -538,27 +538,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- array(1) { [0]=> int(0) @@ -633,7 +612,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(0) @@ -708,7 +687,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(0) @@ -783,7 +762,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(0) @@ -858,7 +837,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -933,7 +912,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation28.phpt b/ext/standard/tests/file/fscanf_variation28.phpt index 18c9726f85362..0444b4b6dd404 100644 --- a/ext/standard/tests/file/fscanf_variation28.phpt +++ b/ext/standard/tests/file/fscanf_variation28.phpt @@ -37,7 +37,7 @@ $float_values = array ( $octal_formats = array( "%o", "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", + " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-7]", "%*o" ); @@ -464,24 +464,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(-9020) @@ -544,7 +526,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(-9020) @@ -607,7 +589,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(-140) @@ -670,7 +652,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(-9020) @@ -733,7 +715,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -796,7 +778,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation3.phpt b/ext/standard/tests/file/fscanf_variation3.phpt index ae197b6f96fce..90afccb9ac2c6 100644 --- a/ext/standard/tests/file/fscanf_variation3.phpt +++ b/ext/standard/tests/file/fscanf_variation3.phpt @@ -41,7 +41,7 @@ $float_values = array ( 10.5e+5 ); -$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); +$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); $counter = 1; @@ -465,24 +465,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(-2147483648) @@ -545,7 +527,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(-2147483648) @@ -608,7 +590,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(-214) @@ -671,7 +653,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(-2147483648) @@ -734,7 +716,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -797,7 +779,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation31.phpt b/ext/standard/tests/file/fscanf_variation31.phpt index a9e2c8b26865a..8325a29c2a06a 100644 --- a/ext/standard/tests/file/fscanf_variation31.phpt +++ b/ext/standard/tests/file/fscanf_variation31.phpt @@ -16,28 +16,19 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; -$octal_formats = array( "%o", "%ho", "%lo", "%Lo", " %o", "%o ", "% o", "\t%o", "\n%o", "%4o", "%30o", "%[0-9]", "%*o"); +$octal_formats = array( "%o", "%ho", "%lo", "%Lo", " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-9]", "%*o"); $counter = 1; @@ -84,11 +75,6 @@ unlink($filename); -- iteration 1 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -97,34 +83,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -153,11 +111,6 @@ bool(false) -- iteration 2 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -166,34 +119,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -222,11 +147,6 @@ bool(false) -- iteration 3 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -235,34 +155,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -291,11 +183,6 @@ bool(false) -- iteration 4 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -304,34 +191,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -360,11 +219,6 @@ bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -373,34 +227,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -429,11 +255,6 @@ bool(false) -- iteration 6 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -442,34 +263,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -497,41 +290,11 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- -NULL NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -560,47 +323,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -629,47 +359,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 10 -- -NULL +-- iteration 9 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -698,47 +395,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 11 -- -NULL +-- iteration 10 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -767,37 +431,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -806,14 +442,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -842,34 +470,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 13 -- -NULL +-- iteration 12 -- NULL array(0) { } @@ -887,22 +490,6 @@ array(0) { } array(0) { } -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} bool(false) *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation33.phpt b/ext/standard/tests/file/fscanf_variation33.phpt index c008c759c9b39..76c26c22c5b6c 100644 --- a/ext/standard/tests/file/fscanf_variation33.phpt +++ b/ext/standard/tests/file/fscanf_variation33.phpt @@ -45,7 +45,7 @@ $valid_ints = array( // various hexa formats $hexa_formats = array( "%x", "%xx", "%lx", "%Lx", - " %x", "%x ", "% x", + " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9A-Fa-f]", "%*x" ); @@ -544,27 +544,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- array(1) { [0]=> int(0) @@ -639,7 +618,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(0) @@ -714,7 +693,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(0) @@ -789,7 +768,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(0) @@ -864,7 +843,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -939,7 +918,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation34.phpt b/ext/standard/tests/file/fscanf_variation34.phpt index 2dad3ace145fa..02f014656192b 100644 --- a/ext/standard/tests/file/fscanf_variation34.phpt +++ b/ext/standard/tests/file/fscanf_variation34.phpt @@ -43,7 +43,7 @@ $float_values = array ( $hexa_formats = array( "%x", "%hx", "%lx", "%Lx", - " %x", "%x ", "% x", + " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9A-Za-z]", "%*x"); @@ -469,24 +469,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(-2147483648) @@ -549,7 +531,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(-2147483648) @@ -612,7 +594,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(-532) @@ -675,7 +657,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(-2147483648) @@ -738,7 +720,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -801,7 +783,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation37.phpt b/ext/standard/tests/file/fscanf_variation37.phpt index d597ebe307c67..6774f34f45c07 100644 --- a/ext/standard/tests/file/fscanf_variation37.phpt +++ b/ext/standard/tests/file/fscanf_variation37.phpt @@ -16,28 +16,19 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; -$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "% x", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x"); +$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x"); $counter = 1; @@ -84,11 +75,6 @@ unlink($filename); -- iteration 1 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -97,14 +83,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -121,18 +99,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -141,23 +107,10 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) -- iteration 2 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -166,22 +119,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -202,18 +139,6 @@ array(1) { [0]=> int(250) } -array(1) { - [0]=> - int(250) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -222,11 +147,6 @@ bool(false) -- iteration 3 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -235,22 +155,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -271,18 +175,6 @@ array(1) { [0]=> int(250) } -array(1) { - [0]=> - int(250) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -291,11 +183,6 @@ bool(false) -- iteration 4 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -304,14 +191,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -328,18 +207,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -348,23 +215,10 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -373,22 +227,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -409,18 +247,6 @@ array(1) { [0]=> int(250) } -array(1) { - [0]=> - int(250) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -429,11 +255,6 @@ bool(false) -- iteration 6 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -442,22 +263,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -478,18 +283,6 @@ array(1) { [0]=> int(250) } -array(1) { - [0]=> - int(250) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -497,41 +290,11 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- -NULL NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -552,22 +315,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -576,31 +323,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -621,22 +351,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -645,31 +359,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 10 -- -NULL +-- iteration 9 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -690,22 +387,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -714,31 +395,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 11 -- -NULL +-- iteration 10 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -759,22 +423,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -783,21 +431,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -806,14 +442,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -842,34 +470,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 13 -- -NULL +-- iteration 12 -- NULL array(0) { } @@ -887,22 +490,6 @@ array(0) { } array(0) { } -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} bool(false) *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation39.phpt b/ext/standard/tests/file/fscanf_variation39.phpt index f04d3b7e3165c..90ca81abd4a8d 100644 --- a/ext/standard/tests/file/fscanf_variation39.phpt +++ b/ext/standard/tests/file/fscanf_variation39.phpt @@ -43,7 +43,7 @@ $valid_ints = array( 017777777777 // max positive integer as octal ); // various unsigned int formats -$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); +$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); $counter = 1; @@ -539,27 +539,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- array(1) { [0]=> int(0) @@ -634,7 +613,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(0) @@ -709,7 +688,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(0) @@ -784,7 +763,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(0) @@ -859,7 +838,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -934,7 +913,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation40.phpt b/ext/standard/tests/file/fscanf_variation40.phpt index 4b12a8cf0a1e9..9d49d899ba171 100644 --- a/ext/standard/tests/file/fscanf_variation40.phpt +++ b/ext/standard/tests/file/fscanf_variation40.phpt @@ -41,7 +41,7 @@ $float_values = array ( 10.5e+5 ); -$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); +$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); $counter = 1; @@ -465,24 +465,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(2147483647) @@ -545,7 +527,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(2147483647) @@ -608,7 +590,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(10) "4294967082" @@ -671,7 +653,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(2147483647) @@ -734,7 +716,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -797,7 +779,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation43.phpt b/ext/standard/tests/file/fscanf_variation43.phpt index 72afbba0c3868..d5ec43ef63d40 100644 --- a/ext/standard/tests/file/fscanf_variation43.phpt +++ b/ext/standard/tests/file/fscanf_variation43.phpt @@ -16,28 +16,19 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; -$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); +$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); $counter = 1; @@ -84,11 +75,6 @@ unlink($filename); -- iteration 1 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -97,34 +83,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -153,11 +111,6 @@ bool(false) -- iteration 2 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -166,34 +119,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -222,11 +147,6 @@ bool(false) -- iteration 3 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -235,34 +155,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -291,11 +183,6 @@ bool(false) -- iteration 4 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -304,34 +191,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -360,11 +219,6 @@ bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -373,34 +227,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -429,11 +255,6 @@ bool(false) -- iteration 6 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -442,34 +263,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -497,41 +290,11 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- -NULL NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -560,47 +323,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -629,47 +359,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 10 -- -NULL +-- iteration 9 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -698,47 +395,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 11 -- -NULL +-- iteration 10 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -767,37 +431,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -806,14 +442,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -842,34 +470,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 13 -- -NULL +-- iteration 12 -- NULL array(0) { } @@ -887,22 +490,6 @@ array(0) { } array(0) { } -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} bool(false) *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation45.phpt b/ext/standard/tests/file/fscanf_variation45.phpt index b694da0e555c6..a85bf76b72d97 100644 --- a/ext/standard/tests/file/fscanf_variation45.phpt +++ b/ext/standard/tests/file/fscanf_variation45.phpt @@ -37,7 +37,7 @@ $valid_ints = array( 017777777777 // max positive integer as octal ); // various scientific formats -$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-1]", "%*e"); +$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "\t%e", "\n%e", "%4e", "%30e", "%[0-1]", "%*e"); $counter = 1; @@ -533,27 +533,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- array(1) { [0]=> float(0) @@ -628,7 +607,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> float(0) @@ -703,7 +682,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> float(0) @@ -778,7 +757,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> float(0) @@ -853,7 +832,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -928,7 +907,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation46.phpt b/ext/standard/tests/file/fscanf_variation46.phpt index bc96af6dbe37d..edaf912e0a7d9 100644 --- a/ext/standard/tests/file/fscanf_variation46.phpt +++ b/ext/standard/tests/file/fscanf_variation46.phpt @@ -35,7 +35,7 @@ $float_values = array ( 10.5e+5 ); -$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); +$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); $counter = 1; @@ -459,24 +459,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> float(-2147483649) @@ -539,7 +521,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> float(-2147483649) @@ -602,7 +584,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> float(-214) @@ -665,7 +647,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> float(-2147483649) @@ -728,7 +710,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -791,7 +773,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation49.phpt b/ext/standard/tests/file/fscanf_variation49.phpt index 43505fc249178..d7f465c1c7c45 100644 --- a/ext/standard/tests/file/fscanf_variation49.phpt +++ b/ext/standard/tests/file/fscanf_variation49.phpt @@ -16,28 +16,19 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; -$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); +$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); $counter = 1; @@ -84,11 +75,6 @@ unlink($filename); -- iteration 1 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -97,34 +83,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -153,11 +111,6 @@ bool(false) -- iteration 2 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -166,34 +119,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -222,11 +147,6 @@ bool(false) -- iteration 3 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -235,34 +155,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -291,11 +183,6 @@ bool(false) -- iteration 4 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -304,34 +191,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -360,11 +219,6 @@ bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -373,34 +227,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -429,11 +255,6 @@ bool(false) -- iteration 6 -- NULL -NULL -array(1) { - [0]=> - float(0) -} array(1) { [0]=> float(0) @@ -442,34 +263,6 @@ array(1) { [0]=> float(1) } -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -497,41 +290,11 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- -NULL NULL array(1) { [0]=> float(0) } -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} array(1) { [0]=> float(1) @@ -560,47 +323,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> float(0) } -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} array(1) { [0]=> float(1) @@ -629,47 +359,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 10 -- -NULL +-- iteration 9 -- NULL array(1) { [0]=> float(0) } -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} array(1) { [0]=> float(1) @@ -698,47 +395,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 11 -- -NULL +-- iteration 10 -- NULL array(1) { [0]=> float(0) } -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} array(1) { [0]=> float(1) @@ -767,37 +431,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -806,14 +442,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -842,34 +470,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 13 -- -NULL +-- iteration 12 -- NULL array(0) { } @@ -887,22 +490,6 @@ array(0) { } array(0) { } -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} bool(false) *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation6.phpt b/ext/standard/tests/file/fscanf_variation6.phpt index 577477e5de604..8f19341cfb72b 100644 --- a/ext/standard/tests/file/fscanf_variation6.phpt +++ b/ext/standard/tests/file/fscanf_variation6.phpt @@ -16,28 +16,19 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; -$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); +$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); $counter = 1; @@ -84,11 +75,6 @@ unlink($filename); -- iteration 1 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -97,34 +83,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -153,11 +111,6 @@ bool(false) -- iteration 2 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -166,34 +119,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -222,11 +147,6 @@ bool(false) -- iteration 3 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -235,34 +155,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -291,11 +183,6 @@ bool(false) -- iteration 4 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -304,34 +191,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -360,11 +219,6 @@ bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -373,34 +227,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -429,11 +255,6 @@ bool(false) -- iteration 6 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -442,34 +263,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -497,41 +290,11 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- -NULL NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -560,47 +323,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -629,47 +359,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 10 -- -NULL +-- iteration 9 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -698,47 +395,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 11 -- -NULL +-- iteration 10 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -767,37 +431,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -806,14 +442,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -842,34 +470,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 13 -- -NULL +-- iteration 12 -- NULL array(0) { } @@ -887,22 +490,6 @@ array(0) { } array(0) { } -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} bool(false) *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation8.phpt b/ext/standard/tests/file/fscanf_variation8.phpt index 2851d7c027736..0a01fd93ee5c2 100644 --- a/ext/standard/tests/file/fscanf_variation8.phpt +++ b/ext/standard/tests/file/fscanf_variation8.phpt @@ -52,7 +52,7 @@ $valid_floats = array( // various float formats $float_formats = array( "%f", "%hf", "%lf", "%Lf", - " %f", "%f ", "% f", + " %f", "%f ", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f", ); @@ -839,39 +839,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 " " -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 -- array(1) { [0]=> float(-2147483649) @@ -994,7 +961,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> float(-2147483649) @@ -1117,7 +1084,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> float(-214) @@ -1240,7 +1207,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> float(-2147483649) @@ -1363,7 +1330,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -1486,7 +1453,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation9.phpt b/ext/standard/tests/file/fscanf_variation9.phpt index 8b88a036f3baf..1d6bb22045ce0 100644 --- a/ext/standard/tests/file/fscanf_variation9.phpt +++ b/ext/standard/tests/file/fscanf_variation9.phpt @@ -44,7 +44,7 @@ $integer_values = array ( 017777777777 // max positive integer as octal ); -$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "% f", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f"); +$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f"); $counter = 1; @@ -540,27 +540,6 @@ array(1) { bool(false) -- iteration 7 -- -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 " " -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 -- array(1) { [0]=> float(0) @@ -635,7 +614,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> float(0) @@ -710,7 +689,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> float(0) @@ -785,7 +764,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> float(0) @@ -860,7 +839,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -935,7 +914,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { From 3889123c7904d131c8fbce93935d2c40cd6fb651 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 11 Dec 2025 17:33:35 +0000 Subject: [PATCH 06/31] ext/standard: Move fscanf tests to subfolder --- ext/standard/tests/file/{ => fscanf}/fscanf.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_error.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation1.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation12.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation14.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation15.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation18.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation2.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation20.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation21.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation24.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation26.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation27.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation28.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation3.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation31.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation33.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation34.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation37.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation39.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation40.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation43.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation45.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation46.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation49.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation51.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation52.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation53.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation55.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation6.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation8.phpt | 0 ext/standard/tests/file/{ => fscanf}/fscanf_variation9.phpt | 0 32 files changed, 0 insertions(+), 0 deletions(-) rename ext/standard/tests/file/{ => fscanf}/fscanf.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_error.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation1.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation12.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation14.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation15.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation18.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation2.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation20.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation21.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation24.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation26.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation27.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation28.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation3.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation31.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation33.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation34.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation37.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation39.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation40.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation43.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation45.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation46.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation49.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation51.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation52.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation53.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation55.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation6.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation8.phpt (100%) rename ext/standard/tests/file/{ => fscanf}/fscanf_variation9.phpt (100%) diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf/fscanf.phpt similarity index 100% rename from ext/standard/tests/file/fscanf.phpt rename to ext/standard/tests/file/fscanf/fscanf.phpt diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf/fscanf_error.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_error.phpt rename to ext/standard/tests/file/fscanf/fscanf_error.phpt diff --git a/ext/standard/tests/file/fscanf_variation1.phpt b/ext/standard/tests/file/fscanf/fscanf_variation1.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation1.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation1.phpt diff --git a/ext/standard/tests/file/fscanf_variation12.phpt b/ext/standard/tests/file/fscanf/fscanf_variation12.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation12.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation12.phpt diff --git a/ext/standard/tests/file/fscanf_variation14.phpt b/ext/standard/tests/file/fscanf/fscanf_variation14.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation14.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation14.phpt diff --git a/ext/standard/tests/file/fscanf_variation15.phpt b/ext/standard/tests/file/fscanf/fscanf_variation15.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation15.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation15.phpt diff --git a/ext/standard/tests/file/fscanf_variation18.phpt b/ext/standard/tests/file/fscanf/fscanf_variation18.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation18.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation18.phpt diff --git a/ext/standard/tests/file/fscanf_variation2.phpt b/ext/standard/tests/file/fscanf/fscanf_variation2.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation2.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation2.phpt diff --git a/ext/standard/tests/file/fscanf_variation20.phpt b/ext/standard/tests/file/fscanf/fscanf_variation20.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation20.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation20.phpt diff --git a/ext/standard/tests/file/fscanf_variation21.phpt b/ext/standard/tests/file/fscanf/fscanf_variation21.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation21.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation21.phpt diff --git a/ext/standard/tests/file/fscanf_variation24.phpt b/ext/standard/tests/file/fscanf/fscanf_variation24.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation24.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation24.phpt diff --git a/ext/standard/tests/file/fscanf_variation26.phpt b/ext/standard/tests/file/fscanf/fscanf_variation26.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation26.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation26.phpt diff --git a/ext/standard/tests/file/fscanf_variation27.phpt b/ext/standard/tests/file/fscanf/fscanf_variation27.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation27.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation27.phpt diff --git a/ext/standard/tests/file/fscanf_variation28.phpt b/ext/standard/tests/file/fscanf/fscanf_variation28.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation28.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation28.phpt diff --git a/ext/standard/tests/file/fscanf_variation3.phpt b/ext/standard/tests/file/fscanf/fscanf_variation3.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation3.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation3.phpt diff --git a/ext/standard/tests/file/fscanf_variation31.phpt b/ext/standard/tests/file/fscanf/fscanf_variation31.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation31.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation31.phpt diff --git a/ext/standard/tests/file/fscanf_variation33.phpt b/ext/standard/tests/file/fscanf/fscanf_variation33.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation33.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation33.phpt diff --git a/ext/standard/tests/file/fscanf_variation34.phpt b/ext/standard/tests/file/fscanf/fscanf_variation34.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation34.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation34.phpt diff --git a/ext/standard/tests/file/fscanf_variation37.phpt b/ext/standard/tests/file/fscanf/fscanf_variation37.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation37.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation37.phpt diff --git a/ext/standard/tests/file/fscanf_variation39.phpt b/ext/standard/tests/file/fscanf/fscanf_variation39.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation39.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation39.phpt diff --git a/ext/standard/tests/file/fscanf_variation40.phpt b/ext/standard/tests/file/fscanf/fscanf_variation40.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation40.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation40.phpt diff --git a/ext/standard/tests/file/fscanf_variation43.phpt b/ext/standard/tests/file/fscanf/fscanf_variation43.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation43.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation43.phpt diff --git a/ext/standard/tests/file/fscanf_variation45.phpt b/ext/standard/tests/file/fscanf/fscanf_variation45.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation45.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation45.phpt diff --git a/ext/standard/tests/file/fscanf_variation46.phpt b/ext/standard/tests/file/fscanf/fscanf_variation46.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation46.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation46.phpt diff --git a/ext/standard/tests/file/fscanf_variation49.phpt b/ext/standard/tests/file/fscanf/fscanf_variation49.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation49.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation49.phpt diff --git a/ext/standard/tests/file/fscanf_variation51.phpt b/ext/standard/tests/file/fscanf/fscanf_variation51.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation51.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation51.phpt diff --git a/ext/standard/tests/file/fscanf_variation52.phpt b/ext/standard/tests/file/fscanf/fscanf_variation52.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation52.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation52.phpt diff --git a/ext/standard/tests/file/fscanf_variation53.phpt b/ext/standard/tests/file/fscanf/fscanf_variation53.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation53.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation53.phpt diff --git a/ext/standard/tests/file/fscanf_variation55.phpt b/ext/standard/tests/file/fscanf/fscanf_variation55.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation55.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation55.phpt diff --git a/ext/standard/tests/file/fscanf_variation6.phpt b/ext/standard/tests/file/fscanf/fscanf_variation6.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation6.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation6.phpt diff --git a/ext/standard/tests/file/fscanf_variation8.phpt b/ext/standard/tests/file/fscanf/fscanf_variation8.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation8.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation8.phpt diff --git a/ext/standard/tests/file/fscanf_variation9.phpt b/ext/standard/tests/file/fscanf/fscanf_variation9.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation9.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation9.phpt From 58d749574a4857c0bf3ae0a7c1066aca49b49c29 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 11 Dec 2025 18:37:52 +0000 Subject: [PATCH 07/31] ext/standard: Refactor fscanf test using strings A bunch of the test cases are testing the language scanner rules rather than fscanf --- .../tests/file/fscanf/fscanf_variation14.phpt | 221 ++++-------------- 1 file changed, 43 insertions(+), 178 deletions(-) diff --git a/ext/standard/tests/file/fscanf/fscanf_variation14.phpt b/ext/standard/tests/file/fscanf/fscanf_variation14.phpt index 05baaad582e92..a5bce1c7276f7 100644 --- a/ext/standard/tests/file/fscanf/fscanf_variation14.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation14.phpt @@ -27,19 +27,10 @@ $heredoc_numeric_string = << - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -165,7 +142,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -182,22 +162,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 2 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -240,7 +208,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -257,22 +228,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 3 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -315,7 +274,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -332,22 +294,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 4 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -390,7 +340,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -407,22 +360,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 5 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -465,7 +406,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -482,22 +426,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 6 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -540,7 +472,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -557,22 +492,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 7 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -615,7 +538,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -632,22 +558,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 8 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -690,7 +604,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -707,22 +624,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 9 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(4) "stri" -} array(1) { [0]=> string(4) "stri" @@ -765,7 +670,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(4) "@#$#" +} array(1) { [0]=> string(4) "This" @@ -782,22 +690,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 10 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -840,7 +736,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -857,12 +756,6 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 11 -- array(1) { @@ -873,18 +766,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -950,23 +831,10 @@ array(1) { [0]=> string(4) "4849" } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 12 -- NULL NULL -NULL -NULL -array(0) { -} array(0) { } array(0) { @@ -989,7 +857,6 @@ array(0) { } array(0) { } -NULL array(0) { } array(0) { @@ -998,9 +865,7 @@ array(0) { } array(0) { } -NULL array(0) { } -bool(false) *** Done *** From a1e9a9a61a1aedc98b399241b09a61e7bf99b77c Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 9 Dec 2025 19:42:51 +0000 Subject: [PATCH 08/31] ext/standard: Move sscanf tests to subfolder --- ext/standard/tests/strings/{ => scanf}/bug21730.phpt | 0 ext/standard/tests/strings/{ => scanf}/bug27295.phpt | 0 ext/standard/tests/strings/{ => scanf}/bug38322.phpt | 0 ext/standard/tests/strings/{ => scanf}/bug42107.phpt | 0 ext/standard/tests/strings/{ => scanf}/bug47322.phpt | 0 ext/standard/tests/strings/{ => scanf}/bug47842.phpt | 2 +- ext/standard/tests/strings/{ => scanf}/gh15552.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_basic1.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_basic2.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_basic3.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_basic4.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_basic5.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_basic6.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_basic7.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_basic8.phpt | 0 ext/standard/tests/strings/{ => scanf}/sscanf_error.phpt | 0 16 files changed, 1 insertion(+), 1 deletion(-) rename ext/standard/tests/strings/{ => scanf}/bug21730.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/bug27295.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/bug38322.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/bug42107.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/bug47322.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/bug47842.phpt (96%) rename ext/standard/tests/strings/{ => scanf}/gh15552.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_basic1.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_basic2.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_basic3.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_basic4.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_basic5.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_basic6.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_basic7.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_basic8.phpt (100%) rename ext/standard/tests/strings/{ => scanf}/sscanf_error.phpt (100%) diff --git a/ext/standard/tests/strings/bug21730.phpt b/ext/standard/tests/strings/scanf/bug21730.phpt similarity index 100% rename from ext/standard/tests/strings/bug21730.phpt rename to ext/standard/tests/strings/scanf/bug21730.phpt diff --git a/ext/standard/tests/strings/bug27295.phpt b/ext/standard/tests/strings/scanf/bug27295.phpt similarity index 100% rename from ext/standard/tests/strings/bug27295.phpt rename to ext/standard/tests/strings/scanf/bug27295.phpt diff --git a/ext/standard/tests/strings/bug38322.phpt b/ext/standard/tests/strings/scanf/bug38322.phpt similarity index 100% rename from ext/standard/tests/strings/bug38322.phpt rename to ext/standard/tests/strings/scanf/bug38322.phpt diff --git a/ext/standard/tests/strings/bug42107.phpt b/ext/standard/tests/strings/scanf/bug42107.phpt similarity index 100% rename from ext/standard/tests/strings/bug42107.phpt rename to ext/standard/tests/strings/scanf/bug42107.phpt diff --git a/ext/standard/tests/strings/bug47322.phpt b/ext/standard/tests/strings/scanf/bug47322.phpt similarity index 100% rename from ext/standard/tests/strings/bug47322.phpt rename to ext/standard/tests/strings/scanf/bug47322.phpt diff --git a/ext/standard/tests/strings/bug47842.phpt b/ext/standard/tests/strings/scanf/bug47842.phpt similarity index 96% rename from ext/standard/tests/strings/bug47842.phpt rename to ext/standard/tests/strings/scanf/bug47842.phpt index 1c8da881e7ced..b8826d89c6bb7 100644 --- a/ext/standard/tests/strings/bug47842.phpt +++ b/ext/standard/tests/strings/scanf/bug47842.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #47842 sscanf() does not support 64-bit values +Bug #47842 sscanf() does not support 64-bit values --SKIPIF-- Date: Tue, 9 Dec 2025 20:46:02 +0000 Subject: [PATCH 09/31] ext/standard: Add some sscanf tests This is in preparation for some major refactoring as the current error messages are non-sensical --- .../strings/scanf/sscanf_binary_strings.phpt | 25 +++++++ .../sscanf_format_string_XPG_assignments.phpt | 47 ++++++++++++ ...at_string_unterminated_rangespecifier.phpt | 45 ++++++++++++ ..._format_string_unterminated_specifier.phpt | 71 +++++++++++++++++++ .../sscanf_range_specifier_edge_cases.phpt | 28 ++++++++ .../scanf/sscanf_range_specifier_ints.phpt | 53 ++++++++++++++ .../scanf/sscanf_range_specifier_strings.phpt | 50 +++++++++++++ 7 files changed, 319 insertions(+) create mode 100644 ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt create mode 100644 ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt create mode 100644 ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt create mode 100644 ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt create mode 100644 ext/standard/tests/strings/scanf/sscanf_range_specifier_edge_cases.phpt create mode 100644 ext/standard/tests/strings/scanf/sscanf_range_specifier_ints.phpt create mode 100644 ext/standard/tests/strings/scanf/sscanf_range_specifier_strings.phpt diff --git a/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt b/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt new file mode 100644 index 0000000000000..ca886153f6979 --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt @@ -0,0 +1,25 @@ +--TEST-- +sscanf(): with strings containing null bytes +--FILE-- +getMessage(), PHP_EOL; +} +try { + var_dump(sscanf($str, $format, $a, $b, $c)); + var_dump($a, $b, $c); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +?> +--EXPECT-- +array(1) { + [0]=> + string(5) "Hello" +} +ValueError: Variable is not assigned by any conversion specifiers diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt new file mode 100644 index 0000000000000..30b2008f79ab1 --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt @@ -0,0 +1,47 @@ +--TEST-- +sscanf(): format string XPG argument tests +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(sscanf($str, $format, $a, $b, $c)); + var_dump($a, $b, $c); + $a = $b = $c = null; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} +?> +--EXPECT-- +Using format string '%1$s %2$s %1$s': +ValueError: Variable is assigned by multiple "%n$" conversion specifiers +ValueError: Variable is assigned by multiple "%n$" conversion specifiers +Using format string '%1$s %*s %3$s': +array(3) { + [0]=> + string(5) "Hello" + [1]=> + NULL + [2]=> + NULL +} +ValueError: Variable is not assigned by any conversion specifiers +Using format string '%s %*s %3$s': +ValueError: cannot mix "%" and "%n$" conversion specifiers +ValueError: cannot mix "%" and "%n$" conversion specifiers diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt new file mode 100644 index 0000000000000..9dc22b46c8912 --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt @@ -0,0 +1,45 @@ +--TEST-- +sscanf(): unterminated range [] specifier +--FILE-- + [$str, $str . $pattern], + $r, + ) + ); + } + return $r; +} + +$modifiers = [ + '^', + ']', +]; + +$formats = combinatorial_concat('%[', $modifiers); + +$str = "Hello World"; + +foreach ($formats as $format) { + echo "Using format string '$format':\n"; + try { + sscanf($str, $format); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} +?> +--EXPECT-- +Using format string '%[': +ValueError: Unmatched [ in format string +Using format string '%[]': +ValueError: Unmatched [ in format string +Using format string '%[^': +ValueError: Unmatched [ in format string +Using format string '%[^]': +ValueError: Unmatched [ in format string diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt new file mode 100644 index 0000000000000..7ff50335a575d --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt @@ -0,0 +1,71 @@ +--TEST-- +sscanf(): format string which is unterminated +--FILE-- + [$str, $str . $pattern], + $r, + ) + ); + } + return $r; +} + +$modifiers = [ + '*', + '1$', // XPG + '2', // Width + 'L', // Size +]; + +$formats = combinatorial_concat('%', $modifiers); + +$str = "Hello World"; + +foreach ($formats as $format) { + echo "Using format string '$format':\n"; + try { + sscanf($str, $format); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} +?> +--EXPECT-- +Using format string '%': +ValueError: Bad scan conversion character " +Using format string '%L': +ValueError: Bad scan conversion character " +Using format string '%2': +ValueError: Bad scan conversion character " +Using format string '%2L': +ValueError: Bad scan conversion character " +Using format string '%1$': +ValueError: Bad scan conversion character " +Using format string '%1$L': +ValueError: Bad scan conversion character " +Using format string '%1$2': +ValueError: Bad scan conversion character " +Using format string '%1$2L': +ValueError: Bad scan conversion character " +Using format string '%*': +ValueError: Bad scan conversion character " +Using format string '%*L': +ValueError: Bad scan conversion character " +Using format string '%*2': +ValueError: Bad scan conversion character " +Using format string '%*2L': +ValueError: Bad scan conversion character " +Using format string '%*1$': +ValueError: Bad scan conversion character "$" +Using format string '%*1$L': +ValueError: Bad scan conversion character "$" +Using format string '%*1$2': +ValueError: Bad scan conversion character "$" +Using format string '%*1$2L': +ValueError: Bad scan conversion character "$" diff --git a/ext/standard/tests/strings/scanf/sscanf_range_specifier_edge_cases.phpt b/ext/standard/tests/strings/scanf/sscanf_range_specifier_edge_cases.phpt new file mode 100644 index 0000000000000..8105dfaefa8b3 --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_range_specifier_edge_cases.phpt @@ -0,0 +1,28 @@ +--TEST-- +sscanf(): test %[] specifier with edge cases +--FILE-- +getMessage(), PHP_EOL; +} +try { + sscanf('-in-', '%[-i-n]', $out); + var_dump($out); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +try { + sscanf('-[in]-', '%[][-i-n]', $out); + var_dump($out); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +?> +--EXPECT-- +string(7) "[hello]" +string(4) "-in-" +string(4) "-in-" diff --git a/ext/standard/tests/strings/scanf/sscanf_range_specifier_ints.phpt b/ext/standard/tests/strings/scanf/sscanf_range_specifier_ints.phpt new file mode 100644 index 0000000000000..f073616ea24dc --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_range_specifier_ints.phpt @@ -0,0 +1,53 @@ +--TEST-- +sscanf(): test %[] specifier with numbers +--FILE-- + +--EXPECT-- +Using format string '%[240531]': +string(12) "001122334455" +Using format string '%[0-5]': +string(12) "001122334455" +Using format string '%[5-0]': +string(12) "001122334455" +Using format string '%[^9687]': +string(12) "001122334455" +Using format string '%[^6-9]': +string(12) "001122334455" +Using format string '%[^9-6]': +string(12) "001122334455" +Using format string '%4[240531]': +string(4) "0011" +Using format string '%4[0-5]': +string(4) "0011" +Using format string '%4[5-0]': +string(4) "0011" +Using format string '%4[^9687]': +string(4) "0011" +Using format string '%4[^6-9]': +string(4) "0011" +Using format string '%4[^9-6]': +string(4) "0011" diff --git a/ext/standard/tests/strings/scanf/sscanf_range_specifier_strings.phpt b/ext/standard/tests/strings/scanf/sscanf_range_specifier_strings.phpt new file mode 100644 index 0000000000000..760725cc93342 --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_range_specifier_strings.phpt @@ -0,0 +1,50 @@ +--TEST-- +sscanf(): test %[] specifier with strings +--FILE-- + +--EXPECT-- +Using format string '%[aefgbcd]': +string(7) "abcdefg" +Using format string '%[a-g]': +string(7) "abcdefg" +Using format string '%[g-a]': +string(7) "abcdefg" +Using format string '%[^uvwstxyz]': +string(18) "abcdefghijklmnopqr" +Using format string '%[^s-z]': +string(18) "abcdefghijklmnopqr" +Using format string '%[^z-s]': +string(18) "abcdefghijklmnopqr" +Using format string '%4[aefgbcd]': +string(4) "abcd" +Using format string '%4[g-a]': +string(4) "abcd" +Using format string '%4[^uvwstxyz]': +string(4) "abcd" +Using format string '%4[^s-z]': +string(4) "abcd" +Using format string '%4[^z-s]': +string(4) "abcd" From d80fff2e9583e59ea9665cd5f48d0aa1a43bcf2d Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 22:33:12 +0000 Subject: [PATCH 10/31] ext/standard/scanf.h: use 0 instead of SUCCESS to define scan success value --- ext/standard/scanf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index d2ef2fc0f2e84..79225cf5025cf 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -23,7 +23,7 @@ /* upper limit to keep resources in check and */ /* minimize the possibility of exploits */ -#define SCAN_SUCCESS SUCCESS +#define SCAN_SUCCESS 0 #define SCAN_ERROR_EOF -1 /* indicates premature termination of scan */ /* can be caused by bad parameters or format*/ /* string. */ From 878fb757f7b54c42d151611af996344464bc2707 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 22:34:31 +0000 Subject: [PATCH 11/31] ext/standard/scanf: drop checking of php_sscanf_internal as it always throws on error --- ext/spl/spl_directory.c | 7 +------ ext/standard/file.c | 9 ++------- ext/standard/scanf.h | 1 - ext/standard/string.c | 8 ++------ 4 files changed, 5 insertions(+), 20 deletions(-) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index ad6fc54aeb3ea..9e40c421791b9 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2494,12 +2494,7 @@ PHP_METHOD(SplFileObject, fscanf) RETURN_THROWS(); } - int result = php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), (int)num_varargs, varargs, 0, return_value); - - if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { - zend_wrong_param_count(); - RETURN_THROWS(); - } + php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), (int)num_varargs, varargs, 0, return_value); } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index fdeabd1872d20..ea6fe816b4619 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -928,7 +928,7 @@ PHPAPI PHP_FUNCTION(fgetc) /* {{{ Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) { - int result, argc = 0; + int argc = 0; size_t format_len; zval *args = NULL; zval *file_handle; @@ -956,14 +956,9 @@ PHP_FUNCTION(fscanf) RETURN_FALSE; } - result = php_sscanf_internal(buf, format, argc, args, 0, return_value); + php_sscanf_internal(buf, format, argc, args, 0, return_value); efree(buf); - - if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { - zend_wrong_param_count(); - RETURN_THROWS(); - } } /* }}} */ diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index 79225cf5025cf..f2e40a29b5ed1 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -28,7 +28,6 @@ /* can be caused by bad parameters or format*/ /* string. */ #define SCAN_ERROR_INVALID_FORMAT (SCAN_ERROR_EOF - 1) -#define SCAN_ERROR_WRONG_PARAM_COUNT (SCAN_ERROR_INVALID_FORMAT - 1) /* * The following are here solely for the benefit of the scanf type functions diff --git a/ext/standard/string.c b/ext/standard/string.c index 0b7d5be1a2576..8d07fe40222f9 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5862,7 +5862,7 @@ PHP_FUNCTION(sscanf) zval *args = NULL; char *str, *format; size_t str_len, format_len; - int result, num_args = 0; + int num_args = 0; ZEND_PARSE_PARAMETERS_START(2, -1) Z_PARAM_STRING(str, str_len) @@ -5870,12 +5870,8 @@ PHP_FUNCTION(sscanf) Z_PARAM_VARIADIC('*', args, num_args) ZEND_PARSE_PARAMETERS_END(); - result = php_sscanf_internal(str, format, num_args, args, 0, return_value); + php_sscanf_internal(str, format, num_args, args, 0, return_value); - if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { - zend_wrong_param_count(); - RETURN_THROWS(); - } } /* }}} */ From 86a447d08ad8ea7a1ca33b5a1c289244392b5a3d Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 23:29:21 +0000 Subject: [PATCH 12/31] ext/standard/scanf: use uint32_t type instead of int for argCount argument --- ext/spl/spl_directory.c | 2 +- ext/standard/file.c | 2 +- ext/standard/scanf.c | 2 +- ext/standard/scanf.h | 2 +- ext/standard/string.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 9e40c421791b9..70b5515bb99b7 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2494,7 +2494,7 @@ PHP_METHOD(SplFileObject, fscanf) RETURN_THROWS(); } - php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), (int)num_varargs, varargs, 0, return_value); + php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), num_varargs, varargs, 0, return_value); } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index ea6fe816b4619..6a4d9baddb4eb 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -928,7 +928,7 @@ PHPAPI PHP_FUNCTION(fgetc) /* {{{ Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) { - int argc = 0; + uint32_t argc = 0; size_t format_len; zval *args = NULL; zval *file_handle; diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 408e5ede88812..c740834397492 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -572,7 +572,7 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) */ PHPAPI int php_sscanf_internal( char *string, char *format, - int argCount, zval *args, + uint32_t argCount, zval *args, int varStart, zval *return_value) { int numVars, nconversions, totalVars = -1; diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index f2e40a29b5ed1..1d28045e5d14a 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -34,7 +34,7 @@ * e.g. fscanf */ PHPAPI int ValidateFormat(char *format, int numVars, int *totalVars); -PHPAPI int php_sscanf_internal(char *string,char *format,int argCount,zval *args, +PHPAPI int php_sscanf_internal(char *string,char *format,uint32_t argCount,zval *args, int varStart, zval *return_value); diff --git a/ext/standard/string.c b/ext/standard/string.c index 8d07fe40222f9..e9a6187a20da9 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5862,7 +5862,7 @@ PHP_FUNCTION(sscanf) zval *args = NULL; char *str, *format; size_t str_len, format_len; - int num_args = 0; + uint32_t num_args = 0; ZEND_PARSE_PARAMETERS_START(2, -1) Z_PARAM_STRING(str, str_len) From 2e5d64a724d8329a9d30b8f28960e6c6120dfd2d Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 23:31:14 +0000 Subject: [PATCH 13/31] ext/standard/scanf: use zend_ulong type instead of int for objIndex variable --- ext/standard/scanf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index c740834397492..21101d78da999 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -578,7 +578,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, int numVars, nconversions, totalVars = -1; int i, result; zend_long value; - int objIndex; + zend_ulong objIndex; char *end, *baseString; zval *current; char op = 0; @@ -695,11 +695,11 @@ PHPAPI int php_sscanf_internal( char *string, char *format, flags |= SCAN_SUPPRESS; ch = format++; } else if ( isdigit(UCHAR(*ch))) { - value = ZEND_STRTOUL(format-1, &end, 10); + zend_ulong assignment_index = ZEND_STRTOUL(format-1, &end, 10); if (*end == '$') { format = end+1; ch = format++; - objIndex = varStart + value - 1; + objIndex = assignment_index - 1; } } From acf692c828967f5f215a6f2d4deea0b57054a8fd Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 23:32:00 +0000 Subject: [PATCH 14/31] ext/standard/scanf: make ValidateFormat function private --- ext/standard/scanf.c | 2 +- ext/standard/scanf.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 21101d78da999..b2129c03b21c2 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -304,7 +304,7 @@ static void ReleaseCharSet(CharSet *cset) * *---------------------------------------------------------------------- */ -PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) +static int ValidateFormat(char *format, int numVars, int *totalSubs) { #define STATIC_LIST_SIZE 16 int gotXpg, gotSequential, value, i, flags; diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index 1d28045e5d14a..c5a97b4f72fdb 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -33,7 +33,6 @@ * The following are here solely for the benefit of the scanf type functions * e.g. fscanf */ -PHPAPI int ValidateFormat(char *format, int numVars, int *totalVars); PHPAPI int php_sscanf_internal(char *string,char *format,uint32_t argCount,zval *args, int varStart, zval *return_value); From 41d4456d081490e4d0d56539ca409b992bc330b1 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 23:35:06 +0000 Subject: [PATCH 15/31] ext/standard/scanf: remove varStart parameter which is always 0 And remove relevant now useless sanity checks --- ext/spl/spl_directory.c | 2 +- ext/standard/file.c | 2 +- ext/standard/scanf.c | 14 ++++---------- ext/standard/scanf.h | 2 +- ext/standard/string.c | 2 +- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 70b5515bb99b7..57cf93b3a82ed 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2494,7 +2494,7 @@ PHP_METHOD(SplFileObject, fscanf) RETURN_THROWS(); } - php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), num_varargs, varargs, 0, return_value); + php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), num_varargs, varargs, return_value); } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index 6a4d9baddb4eb..7e0aebf7c5920 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -956,7 +956,7 @@ PHP_FUNCTION(fscanf) RETURN_FALSE; } - php_sscanf_internal(buf, format, argc, args, 0, return_value); + php_sscanf_internal(buf, format, argc, args, return_value); efree(buf); } diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index b2129c03b21c2..c8702900c5da8 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -567,13 +567,12 @@ static int ValidateFormat(char *format, int numVars, int *totalSubs) * format format string * argCount total number of elements in the args array * args arguments passed in from user function (f|s)scanf - * varStart offset (in args) of 1st variable passed in to (f|s)scanf * return_value set with the results of the scan */ PHPAPI int php_sscanf_internal( char *string, char *format, uint32_t argCount, zval *args, - int varStart, zval *return_value) + zval *return_value) { int numVars, nconversions, totalVars = -1; int i, result; @@ -591,11 +590,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, char buf[64]; /* Temporary buffer to hold scanned number * strings before they are passed to strtoul() */ - /* do some sanity checking */ - if ((varStart > argCount) || (varStart < 0)){ - varStart = SCAN_MAX_ARGS + 1; - } - numVars = argCount - varStart; + numVars = argCount; if (numVars < 0) { numVars = 0; } @@ -608,13 +603,13 @@ PHPAPI int php_sscanf_internal( char *string, char *format, return SCAN_ERROR_INVALID_FORMAT; } - objIndex = numVars ? varStart : 0; + objIndex = 0; /* * If any variables are passed, make sure they are all passed by reference */ if (numVars) { - for (i = varStart;i < argCount;i++){ + for (i = 0; i < argCount; i++){ ZEND_ASSERT(Z_ISREF(args[i]) && "Parameter must be passed by reference"); } } @@ -636,7 +631,6 @@ PHPAPI int php_sscanf_internal( char *string, char *format, return FAILURE; } } - varStart = 0; /* Array index starts from 0 */ } baseString = string; diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index c5a97b4f72fdb..72d1e8c481f02 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -34,7 +34,7 @@ * e.g. fscanf */ PHPAPI int php_sscanf_internal(char *string,char *format,uint32_t argCount,zval *args, - int varStart, zval *return_value); + zval *return_value); #endif /* SCANF_H */ diff --git a/ext/standard/string.c b/ext/standard/string.c index e9a6187a20da9..2a0abb9c106a0 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5870,7 +5870,7 @@ PHP_FUNCTION(sscanf) Z_PARAM_VARIADIC('*', args, num_args) ZEND_PARSE_PARAMETERS_END(); - php_sscanf_internal(str, format, num_args, args, 0, return_value); + php_sscanf_internal(str, format, num_args, args, return_value); } /* }}} */ From 45ba2fb08e9f2c3f917e8c6ac7444c457592d1e9 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 23:50:05 +0000 Subject: [PATCH 16/31] ext/standard/scanf: add assignToVariables variable and parameter This makes the code more obvious --- ext/standard/scanf.c | 53 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index c8702900c5da8..52456287472b8 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -114,7 +114,7 @@ typedef zend_long (*int_string_formater)(const char*, char**, int); static char *BuildCharSet(CharSet *cset, char *format); static int CharInSet(CharSet *cset, int ch); static void ReleaseCharSet(CharSet *cset); -static inline void scan_set_error_return(int numVars, zval *return_value); +static inline void scan_set_error_return(bool assignToVariables, zval *return_value); /* {{{ BuildCharSet @@ -313,6 +313,7 @@ static int ValidateFormat(char *format, int numVars, int *totalSubs) int *nassign = staticAssign; int objIndex, xpgSize, nspace = STATIC_LIST_SIZE; + bool assignToVariables = numVars; /* * Initialize an array that records the number of times a variable * is assigned to by the format string. We use this to detect if @@ -361,9 +362,9 @@ static int ValidateFormat(char *format, int numVars, int *totalSubs) if (gotSequential) { goto mixedXPG; } - if ((value < 1) || (numVars && (value > numVars))) { + if ((value < 1) || (assignToVariables && (value > numVars))) { goto badIndex; - } else if (numVars == 0) { + } else if (!assignToVariables) { /* * In the case where no vars are specified, the user can * specify %9999$ legally, so we have to consider special @@ -410,7 +411,7 @@ static int ValidateFormat(char *format, int numVars, int *totalSubs) ch = format++; } - if (!(flags & SCAN_SUPPRESS) && numVars && (objIndex >= numVars)) { + if (!(flags & SCAN_SUPPRESS) && assignToVariables && (objIndex >= numVars)) { goto badIndex; } @@ -513,7 +514,7 @@ static int ValidateFormat(char *format, int numVars, int *totalSubs) /* * Verify that all of the variable were assigned exactly once. */ - if (numVars == 0) { + if (!assignToVariables) { if (xpgSize) { numVars = xpgSize; } else { @@ -595,11 +596,13 @@ PHPAPI int php_sscanf_internal( char *string, char *format, numVars = 0; } + bool assignToVariables = numVars; + /* * Check for errors in the format string. */ if (ValidateFormat(format, numVars, &totalVars) != SCAN_SUCCESS) { - scan_set_error_return( numVars, return_value ); + scan_set_error_return( assignToVariables, return_value ); return SCAN_ERROR_INVALID_FORMAT; } @@ -608,7 +611,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, /* * If any variables are passed, make sure they are all passed by reference */ - if (numVars) { + if (assignToVariables) { for (i = 0; i < argCount; i++){ ZEND_ASSERT(Z_ISREF(args[i]) && "Parameter must be passed by reference"); } @@ -618,7 +621,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, * Allocate space for the result objects. Only happens when no variables * are specified */ - if (!numVars) { + if (!assignToVariables) { zval tmp; /* allocate an array for return */ @@ -720,9 +723,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, switch (*ch) { case 'n': if (!(flags & SCAN_SUPPRESS)) { - if (numVars && objIndex >= argCount) { + if (assignToVariables && objIndex >= argCount) { break; - } else if (numVars) { + } else if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_LONG(current, (zend_long) (string - baseString)); } else { @@ -838,9 +841,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, } } if (!(flags & SCAN_SUPPRESS)) { - if (numVars && objIndex >= argCount) { + if (assignToVariables && objIndex >= argCount) { break; - } else if (numVars) { + } else if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_STRINGL(current, string, end - string); } else { @@ -878,9 +881,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, goto done; } if (!(flags & SCAN_SUPPRESS)) { - if (numVars && objIndex >= argCount) { + if (assignToVariables && objIndex >= argCount) { break; - } else if (numVars) { + } else if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_STRINGL(current, string, end - string); } else { @@ -897,7 +900,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, sch = *string; string++; if (!(flags & SCAN_SUPPRESS)) { - if (numVars) { + if (assignToVariables) { char __buf[2]; __buf[0] = sch; __buf[1] = '\0'; @@ -1030,9 +1033,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, value = (zend_long) (*fn)(buf, NULL, base); if ((flags & SCAN_UNSIGNED) && (value < 0)) { snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, value); /* INTL: ISO digit */ - if (numVars && objIndex >= argCount) { + if (assignToVariables && objIndex >= argCount) { break; - } else if (numVars) { + } else if (assignToVariables) { /* change passed value type to string */ current = args + objIndex++; ZEND_TRY_ASSIGN_REF_STRING(current, buf); @@ -1040,9 +1043,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, add_index_string(return_value, objIndex++, buf); } } else { - if (numVars && objIndex >= argCount) { + if (assignToVariables && objIndex >= argCount) { break; - } else if (numVars) { + } else if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_LONG(current, value); } else { @@ -1144,9 +1147,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, double dvalue; *end = '\0'; dvalue = zend_strtod(buf, NULL); - if (numVars && objIndex >= argCount) { + if (assignToVariables && objIndex >= argCount) { break; - } else if (numVars) { + } else if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_DOUBLE(current, dvalue); } else { @@ -1162,9 +1165,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, result = SCAN_SUCCESS; if (underflow && (0==nconversions)) { - scan_set_error_return( numVars, return_value ); + scan_set_error_return( assignToVariables, return_value ); result = SCAN_ERROR_EOF; - } else if (numVars) { + } else if (assignToVariables) { zval_ptr_dtor(return_value ); ZVAL_LONG(return_value, nconversions); } else if (nconversions < totalVars) { @@ -1175,9 +1178,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, /* }}} */ /* the compiler choked when i tried to make this a macro */ -static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */ +static inline void scan_set_error_return(bool assignToVariables, zval *return_value) /* {{{ */ { - if (numVars) { + if (assignToVariables) { ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */ } else { /* convert_to_null calls destructor */ From fe6146039696e8c9b4fc8d1f4db3d24cb6357279 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 23:52:24 +0000 Subject: [PATCH 17/31] ext/standard/scanf: use type uint32_t instead of int for totalSubs parameter of ValidateFormat() --- ext/standard/scanf.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 52456287472b8..66b450eeb7d8c 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -304,7 +304,7 @@ static void ReleaseCharSet(CharSet *cset) * *---------------------------------------------------------------------- */ -static int ValidateFormat(char *format, int numVars, int *totalSubs) +static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) { #define STATIC_LIST_SIZE 16 int gotXpg, gotSequential, value, i, flags; @@ -521,9 +521,9 @@ static int ValidateFormat(char *format, int numVars, int *totalSubs) numVars = objIndex; } } - if (totalSubs) { - *totalSubs = numVars; - } + + *totalSubs = numVars; + for (i = 0; i < numVars; i++) { if (nassign[i] > 1) { zend_value_error("%s", "Variable is assigned by multiple \"%n$\" conversion specifiers"); @@ -575,7 +575,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, uint32_t argCount, zval *args, zval *return_value) { - int numVars, nconversions, totalVars = -1; + int numVars, nconversions; int i, result; zend_long value; zend_ulong objIndex; @@ -601,6 +601,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, /* * Check for errors in the format string. */ + uint32_t totalVars = 0; if (ValidateFormat(format, numVars, &totalVars) != SCAN_SUCCESS) { scan_set_error_return( assignToVariables, return_value ); return SCAN_ERROR_INVALID_FORMAT; @@ -627,7 +628,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, /* allocate an array for return */ array_init(return_value); - for (i = 0; i < totalVars; i++) { + for (uint32_t i = 0; i < totalVars; i++) { ZVAL_NULL(&tmp); if (add_next_index_zval(return_value, &tmp) == FAILURE) { scan_set_error_return(0, return_value); From a431568838cab858439d6b74e42174a0779fe137 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 00:03:03 +0000 Subject: [PATCH 18/31] ext/standard/scanf: use type bool instead of int for variables in ValidateFormat() --- ext/standard/scanf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 66b450eeb7d8c..ad42db858ae9b 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -307,7 +307,9 @@ static void ReleaseCharSet(CharSet *cset) static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) { #define STATIC_LIST_SIZE 16 - int gotXpg, gotSequential, value, i, flags; + int value, i, flags; + bool gotXpg = false; + bool gotSequential = false; char *end, *ch = NULL; int staticAssign[STATIC_LIST_SIZE]; int *nassign = staticAssign; @@ -327,7 +329,7 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) nassign[i] = 0; } - xpgSize = objIndex = gotXpg = gotSequential = 0; + xpgSize = objIndex = 0; while (*format != '\0') { ch = format++; @@ -358,7 +360,7 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) } format = end+1; ch = format++; - gotXpg = 1; + gotXpg = true; if (gotSequential) { goto mixedXPG; } @@ -387,7 +389,7 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) } notXpg: - gotSequential = 1; + gotSequential = true; if (gotXpg) { mixedXPG: zend_value_error("%s", "cannot mix \"%\" and \"%n$\" conversion specifiers"); From 90038477660434b6127a2dbb879550a7e1b39af4 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 23:56:03 +0000 Subject: [PATCH 19/31] ext/standard/scanf: use type uint32_t instead of int for variables in ValidateFormat() --- ext/standard/scanf.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index ad42db858ae9b..1fb0d8c10708f 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -304,16 +304,19 @@ static void ReleaseCharSet(CharSet *cset) * *---------------------------------------------------------------------- */ -static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) +static int ValidateFormat(char *format, uint32_t numVars, uint32_t *totalSubs) { #define STATIC_LIST_SIZE 16 - int value, i, flags; + int flags; bool gotXpg = false; bool gotSequential = false; char *end, *ch = NULL; - int staticAssign[STATIC_LIST_SIZE]; - int *nassign = staticAssign; - int objIndex, xpgSize, nspace = STATIC_LIST_SIZE; + uint32_t staticAssign[STATIC_LIST_SIZE]; + uint32_t *nassign = staticAssign; + uint32_t objIndex = 0; + uint32_t xpgSize = 0; + uint32_t nspace = STATIC_LIST_SIZE; + zend_ulong value; bool assignToVariables = numVars; /* @@ -322,15 +325,13 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) * a variable is multiply assigned or left unassigned. */ if (numVars > nspace) { - nassign = (int*)safe_emalloc(sizeof(int), numVars, 0); + nassign = safe_emalloc(sizeof(uint32_t), numVars, 0); nspace = numVars; } for (i = 0; i < nspace; i++) { nassign[i] = 0; } - xpgSize = objIndex = 0; - while (*format != '\0') { ch = format++; flags = 0; @@ -490,7 +491,7 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) * make sure that we grow to a large enough size. xpgSize is * guaranteed to be at least one larger than objIndex. */ - value = nspace; + uint32_t value = nspace; if (xpgSize) { nspace = xpgSize; } else { @@ -498,13 +499,13 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) } if (nassign == staticAssign) { nassign = (void *)safe_emalloc(nspace, sizeof(int), 0); - for (i = 0; i < STATIC_LIST_SIZE; ++i) { + for (uint32_t i = 0; i < STATIC_LIST_SIZE; ++i) { nassign[i] = staticAssign[i]; } } else { nassign = (void *)erealloc((void *)nassign, nspace * sizeof(int)); } - for (i = value; i < nspace; i++) { + for (uint32_t i = value; i < nspace; i++) { nassign[i] = 0; } } @@ -526,7 +527,7 @@ static int ValidateFormat(char *format, int numVars, uint32_t *totalSubs) *totalSubs = numVars; - for (i = 0; i < numVars; i++) { + for (uint32_t i = 0; i < numVars; i++) { if (nassign[i] > 1) { zend_value_error("%s", "Variable is assigned by multiple \"%n$\" conversion specifiers"); goto error; From 57025bd91140da7c420155f30a643d1b947e381b Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 4 Dec 2025 23:57:54 +0000 Subject: [PATCH 20/31] ext/standard/scanf: use memset to initialize array of 0s --- ext/standard/scanf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 1fb0d8c10708f..a14017499d6a3 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -328,9 +328,7 @@ static int ValidateFormat(char *format, uint32_t numVars, uint32_t *totalSubs) nassign = safe_emalloc(sizeof(uint32_t), numVars, 0); nspace = numVars; } - for (i = 0; i < nspace; i++) { - nassign[i] = 0; - } + memset(nassign, 0, sizeof(uint32_t)*numVars); while (*format != '\0') { ch = format++; From 6772c8fdf26da147d57fc586b9d959c60756183d Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 00:13:40 +0000 Subject: [PATCH 21/31] ext/standard/scanf: remove unused includes --- ext/standard/scanf.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index a14017499d6a3..2fdd56a45246f 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -65,13 +65,8 @@ #include #include #include "php.h" -#include "php_variables.h" #include -#include "zend_execute.h" -#include "zend_operators.h" #include "zend_strtod.h" -#include "php_globals.h" -#include "basic_functions.h" #include "scanf.h" /* From 8eea8e693db827fa83fdea84e6f7ca45bf19a451 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 00:23:30 +0000 Subject: [PATCH 22/31] ext/standard/scanf: refactor CharInSet() --- ext/standard/scanf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 2fdd56a45246f..5c4067b03da17 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -107,7 +107,7 @@ typedef zend_long (*int_string_formater)(const char*, char**, int); * Declarations for functions used only in this file. */ static char *BuildCharSet(CharSet *cset, char *format); -static int CharInSet(CharSet *cset, int ch); +static bool CharInSet(const CharSet *cset, char c); static void ReleaseCharSet(CharSet *cset); static inline void scan_set_error_return(bool assignToVariables, zval *return_value); @@ -230,22 +230,22 @@ static char * BuildCharSet(CharSet *cset, char *format) * *---------------------------------------------------------------------- */ -static int CharInSet(CharSet *cset, int c) +static bool CharInSet(const CharSet *cset, char c) { - char ch = (char) c; - int i, match = 0; + int i; + bool match = false; for (i = 0; i < cset->nchars; i++) { - if (cset->chars[i] == ch) { - match = 1; + if (cset->chars[i] == c) { + match = true; break; } } if (!match) { for (i = 0; i < cset->nranges; i++) { - if ((cset->ranges[i].start <= ch) - && (ch <= cset->ranges[i].end)) { - match = 1; + if ((cset->ranges[i].start <= c) + && (c <= cset->ranges[i].end)) { + match = true; break; } } @@ -861,7 +861,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, format = BuildCharSet(&cset, format); while (*end != '\0') { sch = *end; - if (!CharInSet(&cset, (int)sch)) { + if (!CharInSet(&cset, sch)) { break; } end++; From 9209efd16719a870a397bf9cc17e871a33a2f29f Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 02:07:16 +0000 Subject: [PATCH 23/31] ext/standard/scanf: add const qualifiers in BuildCharSet() and ValidateFormat() --- ext/standard/scanf.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 5c4067b03da17..15cc93415de65 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -131,9 +131,9 @@ static inline void scan_set_error_return(bool assignToVariables, zval *return_va */ static char * BuildCharSet(CharSet *cset, char *format) { - char *ch, start; + const char *ch; int nranges; - char *end; + const char *end; memset(cset, 0, sizeof(CharSet)); @@ -170,7 +170,7 @@ static char * BuildCharSet(CharSet *cset, char *format) */ cset->nchars = cset->nranges = 0; ch = format++; - start = *ch; + char start = *ch; if (*ch == ']' || *ch == '-') { cset->chars[cset->nchars++] = *ch; ch = format++; @@ -299,13 +299,13 @@ static void ReleaseCharSet(CharSet *cset) * *---------------------------------------------------------------------- */ -static int ValidateFormat(char *format, uint32_t numVars, uint32_t *totalSubs) +static int ValidateFormat(const char *format, uint32_t numVars, uint32_t *totalSubs) { #define STATIC_LIST_SIZE 16 int flags; bool gotXpg = false; bool gotSequential = false; - char *end, *ch = NULL; + const char *ch = NULL; uint32_t staticAssign[STATIC_LIST_SIZE]; uint32_t *nassign = staticAssign; uint32_t objIndex = 0; @@ -348,6 +348,7 @@ static int ValidateFormat(char *format, uint32_t numVars, uint32_t *totalSubs) * must not be a mixture of XPG3 specs and non-XPG3 specs * in the same format string. */ + char *end = NULL; value = ZEND_STRTOUL(format-1, &end, 10); if (*end != '$') { goto notXpg; @@ -395,8 +396,10 @@ static int ValidateFormat(char *format, uint32_t numVars, uint32_t *totalSubs) * Parse any width specifier. */ if (isdigit(UCHAR(*ch))) { - value = ZEND_STRTOUL(format-1, &format, 10); + char *end = NULL; + value = ZEND_STRTOUL(format-1, &end, 10); flags |= SCAN_WIDTH; + format = end; ch = format++; } From b75745f3ef747288d2e7a57be4465b0621886358 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 02:09:36 +0000 Subject: [PATCH 24/31] unsigned vars --- ext/standard/scanf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 15cc93415de65..11025f339b857 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -575,7 +575,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, zval *return_value) { int numVars, nconversions; - int i, result; + int result; zend_long value; zend_ulong objIndex; char *end, *baseString; @@ -612,7 +612,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format, * If any variables are passed, make sure they are all passed by reference */ if (assignToVariables) { - for (i = 0; i < argCount; i++){ + for (uint32_t i = 0; i < argCount; i++){ ZEND_ASSERT(Z_ISREF(args[i]) && "Parameter must be passed by reference"); } } From a9a9401fc9c87ccf4aaaa1460c0ff47765dbd132 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 02:16:30 +0000 Subject: [PATCH 25/31] ext/standard/scanf: add const qualifiers for format param --- ext/standard/scanf.c | 16 ++++++++++------ ext/standard/scanf.h | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 11025f339b857..164060f51a795 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -106,7 +106,7 @@ typedef zend_long (*int_string_formater)(const char*, char**, int); /* * Declarations for functions used only in this file. */ -static char *BuildCharSet(CharSet *cset, char *format); +static const char * BuildCharSet(CharSet *cset, const char *format); static bool CharInSet(const CharSet *cset, char c); static void ReleaseCharSet(CharSet *cset); static inline void scan_set_error_return(bool assignToVariables, zval *return_value); @@ -129,7 +129,7 @@ static inline void scan_set_error_return(bool assignToVariables, zval *return_va * *---------------------------------------------------------------------- */ -static char * BuildCharSet(CharSet *cset, char *format) +static const char * BuildCharSet(CharSet *cset, const char *format) { const char *ch; int nranges; @@ -570,7 +570,7 @@ static int ValidateFormat(const char *format, uint32_t numVars, uint32_t *totalS * return_value set with the results of the scan */ -PHPAPI int php_sscanf_internal( char *string, char *format, +PHPAPI int php_sscanf_internal( char *string, const char *format, uint32_t argCount, zval *args, zval *return_value) { @@ -578,14 +578,16 @@ PHPAPI int php_sscanf_internal( char *string, char *format, int result; zend_long value; zend_ulong objIndex; - char *end, *baseString; + char *end; + const char *baseString; zval *current; char op = 0; int base = 0; int underflow = 0; size_t width; int_string_formater fn = NULL; - char *ch, sch; + const char *ch; + char sch; int flags; char buf[64]; /* Temporary buffer to hold scanned number * strings before they are passed to strtoul() */ @@ -704,7 +706,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, * Parse any width specifier. */ if ( isdigit(UCHAR(*ch))) { - width = ZEND_STRTOUL(format-1, &format, 10); + char *end_ptr = NULL; + width = ZEND_STRTOUL(format-1, &end_ptr, 10); + format = end_ptr; ch = format++; } else { width = 0; diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index 72d1e8c481f02..91a9592368e76 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -33,7 +33,7 @@ * The following are here solely for the benefit of the scanf type functions * e.g. fscanf */ -PHPAPI int php_sscanf_internal(char *string,char *format,uint32_t argCount,zval *args, +PHPAPI int php_sscanf_internal(char *string, const char *format,uint32_t argCount,zval *args, zval *return_value); From 89ac4f5de23aed138aeb61ccf5ecd7770135dfa1 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 02:40:45 +0000 Subject: [PATCH 26/31] ext/standard/scanf: add const qualifiers for string param --- ext/standard/scanf.c | 47 +++++++++++++++++++++++++------------------- ext/standard/scanf.h | 2 +- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 164060f51a795..39a431b33cdfc 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -570,7 +570,7 @@ static int ValidateFormat(const char *format, uint32_t numVars, uint32_t *totalS * return_value set with the results of the scan */ -PHPAPI int php_sscanf_internal( char *string, const char *format, +PHPAPI int php_sscanf_internal(const char *string, const char *format, uint32_t argCount, zval *args, zval *return_value) { @@ -578,7 +578,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, int result; zend_long value; zend_ulong objIndex; - char *end; + const char *end; const char *baseString; zval *current; char op = 0; @@ -589,8 +589,6 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, const char *ch; char sch; int flags; - char buf[64]; /* Temporary buffer to hold scanned number - * strings before they are passed to strtoul() */ numVars = argCount; if (numVars < 0) { @@ -694,6 +692,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, flags |= SCAN_SUPPRESS; ch = format++; } else if ( isdigit(UCHAR(*ch))) { + char *end = NULL; zend_ulong assignment_index = ZEND_STRTOUL(format-1, &end, 10); if (*end == '$') { format = end+1; @@ -917,7 +916,10 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, } break; */ - case 'i': + case 'i': { + /* Temporary buffer to hold scanned number */ + char buf[64]; + char *buf_end; /* * Scan an unsigned or signed integer. */ @@ -929,7 +931,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, } flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO; - for (end = buf; width > 0; width--) { + for (buf_end = buf; width > 0; width--) { switch (*string) { /* * The 0 digit has special meaning at the beginning of @@ -967,7 +969,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, base = 10; } if (base <= 8) { - break; + break; } flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); goto addToInt; @@ -990,7 +992,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, break; case 'x': case 'X': - if ((flags & SCAN_XOK) && (end == buf+1)) { + if ((flags & SCAN_XOK) && (buf_end == buf+1)) { base = 16; flags &= ~SCAN_XOK; goto addToInt; @@ -1007,7 +1009,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, /* * Add the character to the temporary buffer. */ - *end++ = *string++; + *buf_end++ = *string++; if (*string == '\0') { break; } @@ -1022,8 +1024,8 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, underflow = 1; } goto done; - } else if (end[-1] == 'x' || end[-1] == 'X') { - end--; + } else if (buf_end[-1] == 'x' || buf_end[-1] == 'X') { + buf_end--; string--; } @@ -1033,14 +1035,14 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, * to a string since PHP only supports signed values. */ if (!(flags & SCAN_SUPPRESS)) { - *end = '\0'; + *buf_end = '\0'; value = (zend_long) (*fn)(buf, NULL, base); if ((flags & SCAN_UNSIGNED) && (value < 0)) { snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, value); /* INTL: ISO digit */ if (assignToVariables && objIndex >= argCount) { break; } else if (assignToVariables) { - /* change passed value type to string */ + /* change passed value type to string */ current = args + objIndex++; ZEND_TRY_ASSIGN_REF_STRING(current, buf); } else { @@ -1058,8 +1060,12 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, } } break; + } - case 'f': + case 'f': { + /* Temporary buffer to hold scanned number */ + char buf[64]; + char *buf_end; /* * Scan a floating point number */ @@ -1068,7 +1074,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, width = sizeof(buf) - 1; } flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_PTOK | SCAN_EXPOK; - for (end = buf; width > 0; width--) { + for (buf_end = buf; width > 0; width--) { switch (*string) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': @@ -1111,7 +1117,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, /* * Add the character to the temporary buffer. */ - *end++ = *string++; + *buf_end++ = *string++; if (*string == '\0') { break; } @@ -1136,10 +1142,10 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, /* * We got a bad exponent ('e' and maybe a sign). */ - end--; + buf_end--; string--; - if (*end != 'e' && *end != 'E') { - end--; + if (*buf_end != 'e' && *buf_end != 'E') { + buf_end--; string--; } } @@ -1149,7 +1155,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, */ if (!(flags & SCAN_SUPPRESS)) { double dvalue; - *end = '\0'; + *buf_end = '\0'; dvalue = zend_strtod(buf, NULL); if (assignToVariables && objIndex >= argCount) { break; @@ -1161,6 +1167,7 @@ PHPAPI int php_sscanf_internal( char *string, const char *format, } } break; + } } /* switch (op) */ nconversions++; } /* while (*format != '\0') */ diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index 91a9592368e76..9bd06c1c3fe7f 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -33,7 +33,7 @@ * The following are here solely for the benefit of the scanf type functions * e.g. fscanf */ -PHPAPI int php_sscanf_internal(char *string, const char *format,uint32_t argCount,zval *args, +PHPAPI int php_sscanf_internal(const char *string, const char *format,uint32_t argCount,zval *args, zval *return_value); From a4cdd523c5b70a0efb15e96416d069c041c2760c Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 02:53:28 +0000 Subject: [PATCH 27/31] ext/standard/scanf: convert format param to zend_string In preparation for better format parsing --- ext/spl/spl_directory.c | 2 +- ext/standard/file.c | 6 +++--- ext/standard/scanf.c | 8 +++++--- ext/standard/scanf.h | 2 +- ext/standard/string.c | 7 ++++--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 57cf93b3a82ed..b54a698c78081 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2494,7 +2494,7 @@ PHP_METHOD(SplFileObject, fscanf) RETURN_THROWS(); } - php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), num_varargs, varargs, return_value); + php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), format_str, num_varargs, varargs, return_value); } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index 7e0aebf7c5920..294915817c538 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -929,16 +929,16 @@ PHPAPI PHP_FUNCTION(fgetc) PHP_FUNCTION(fscanf) { uint32_t argc = 0; - size_t format_len; zval *args = NULL; zval *file_handle; - char *buf, *format; + char *buf; + zend_string *format; size_t len; void *what; ZEND_PARSE_PARAMETERS_START(2, -1) Z_PARAM_RESOURCE(file_handle) - Z_PARAM_STRING(format, format_len) + Z_PARAM_STR(format) Z_PARAM_VARIADIC('*', args, argc) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 39a431b33cdfc..bb5f6acbd952f 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -299,7 +299,7 @@ static void ReleaseCharSet(CharSet *cset) * *---------------------------------------------------------------------- */ -static int ValidateFormat(const char *format, uint32_t numVars, uint32_t *totalSubs) +static int ValidateFormat(const zend_string *zstr_format, uint32_t numVars, uint32_t *totalSubs) { #define STATIC_LIST_SIZE 16 int flags; @@ -325,6 +325,7 @@ static int ValidateFormat(const char *format, uint32_t numVars, uint32_t *totalS } memset(nassign, 0, sizeof(uint32_t)*numVars); + const char *format = ZSTR_VAL(zstr_format); while (*format != '\0') { ch = format++; flags = 0; @@ -570,7 +571,7 @@ static int ValidateFormat(const char *format, uint32_t numVars, uint32_t *totalS * return_value set with the results of the scan */ -PHPAPI int php_sscanf_internal(const char *string, const char *format, +PHPAPI int php_sscanf_internal(const char *string, const zend_string *zstr_format, uint32_t argCount, zval *args, zval *return_value) { @@ -601,7 +602,7 @@ PHPAPI int php_sscanf_internal(const char *string, const char *format, * Check for errors in the format string. */ uint32_t totalVars = 0; - if (ValidateFormat(format, numVars, &totalVars) != SCAN_SUCCESS) { + if (ValidateFormat(zstr_format, numVars, &totalVars) != SCAN_SUCCESS) { scan_set_error_return( assignToVariables, return_value ); return SCAN_ERROR_INVALID_FORMAT; } @@ -646,6 +647,7 @@ PHPAPI int php_sscanf_internal(const char *string, const char *format, nconversions = 0; /* note ! - we need to limit the loop for objIndex to keep it in bounds */ + const char *format = ZSTR_VAL(zstr_format); while (*format != '\0') { ch = format++; flags = 0; diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index 9bd06c1c3fe7f..f692c8537b6e2 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -33,7 +33,7 @@ * The following are here solely for the benefit of the scanf type functions * e.g. fscanf */ -PHPAPI int php_sscanf_internal(const char *string, const char *format,uint32_t argCount,zval *args, +PHPAPI int php_sscanf_internal(const char *string, const zend_string *format, uint32_t argCount, zval *args, zval *return_value); diff --git a/ext/standard/string.c b/ext/standard/string.c index 2a0abb9c106a0..1ffc20ff4a9cf 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5860,13 +5860,14 @@ PHP_FUNCTION(str_pad) PHP_FUNCTION(sscanf) { zval *args = NULL; - char *str, *format; - size_t str_len, format_len; + char *str; + size_t str_len; + zend_string *format; uint32_t num_args = 0; ZEND_PARSE_PARAMETERS_START(2, -1) Z_PARAM_STRING(str, str_len) - Z_PARAM_STRING(format, format_len) + Z_PARAM_STR(format) Z_PARAM_VARIADIC('*', args, num_args) ZEND_PARSE_PARAMETERS_END(); From 50a41d47a6e8993d9ef6c5187a8f454100dbb4b9 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 5 Dec 2025 03:00:44 +0000 Subject: [PATCH 28/31] ext/standard/scanf: add format_arg_num param In preparation for better format parsing --- ext/spl/spl_directory.c | 2 +- ext/standard/file.c | 2 +- ext/standard/scanf.c | 6 +++--- ext/standard/scanf.h | 2 +- ext/standard/string.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index b54a698c78081..b0d540bf423e7 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2494,7 +2494,7 @@ PHP_METHOD(SplFileObject, fscanf) RETURN_THROWS(); } - php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), format_str, num_varargs, varargs, return_value); + php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), format_str, 1, num_varargs, varargs, return_value); } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index 294915817c538..0d9c43f2b3107 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -956,7 +956,7 @@ PHP_FUNCTION(fscanf) RETURN_FALSE; } - php_sscanf_internal(buf, format, argc, args, return_value); + php_sscanf_internal(buf, format, 2, argc, args, return_value); efree(buf); } diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index bb5f6acbd952f..480a3e7ff9360 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -299,7 +299,7 @@ static void ReleaseCharSet(CharSet *cset) * *---------------------------------------------------------------------- */ -static int ValidateFormat(const zend_string *zstr_format, uint32_t numVars, uint32_t *totalSubs) +static int ValidateFormat(const zend_string *zstr_format, uint32_t format_arg_num, uint32_t numVars, uint32_t *totalSubs) { #define STATIC_LIST_SIZE 16 int flags; @@ -571,7 +571,7 @@ static int ValidateFormat(const zend_string *zstr_format, uint32_t numVars, uint * return_value set with the results of the scan */ -PHPAPI int php_sscanf_internal(const char *string, const zend_string *zstr_format, +PHPAPI int php_sscanf_internal(const char *string, const zend_string *zstr_format, uint32_t format_arg_num, uint32_t argCount, zval *args, zval *return_value) { @@ -602,7 +602,7 @@ PHPAPI int php_sscanf_internal(const char *string, const zend_string *zstr_forma * Check for errors in the format string. */ uint32_t totalVars = 0; - if (ValidateFormat(zstr_format, numVars, &totalVars) != SCAN_SUCCESS) { + if (ValidateFormat(zstr_format, format_arg_num, numVars, &totalVars) != SCAN_SUCCESS) { scan_set_error_return( assignToVariables, return_value ); return SCAN_ERROR_INVALID_FORMAT; } diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index f692c8537b6e2..1bfa4707d0aae 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -33,7 +33,7 @@ * The following are here solely for the benefit of the scanf type functions * e.g. fscanf */ -PHPAPI int php_sscanf_internal(const char *string, const zend_string *format, uint32_t argCount, zval *args, +PHPAPI int php_sscanf_internal(const char *string, const zend_string *format, uint32_t format_arg_num, uint32_t argCount, zval *args, zval *return_value); diff --git a/ext/standard/string.c b/ext/standard/string.c index 1ffc20ff4a9cf..887192d2dd311 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5871,7 +5871,7 @@ PHP_FUNCTION(sscanf) Z_PARAM_VARIADIC('*', args, num_args) ZEND_PARSE_PARAMETERS_END(); - php_sscanf_internal(str, format, num_args, args, return_value); + php_sscanf_internal(str, format, 2, num_args, args, return_value); } /* }}} */ From 3182b2e21234000c81b78e9dcfdb17cbe5868fa7 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Sun, 7 Dec 2025 18:20:54 +0000 Subject: [PATCH 29/31] Refactor string format parsing --- ext/standard/scanf.c | 272 ++++++++++-------- ext/standard/tests/file/fscanf/fscanf.phpt | 8 +- .../tests/file/fscanf/fscanf_error.phpt | 10 +- ext/standard/tests/strings/scanf/gh15552.phpt | 12 +- .../strings/scanf/sscanf_binary_strings.phpt | 11 +- .../tests/strings/scanf/sscanf_error.phpt | 2 +- .../sscanf_format_string_XPG_assignments.phpt | 10 +- ...at_string_unterminated_rangespecifier.phpt | 8 +- ..._format_string_unterminated_specifier.phpt | 32 +-- 9 files changed, 200 insertions(+), 165 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 480a3e7ff9360..e25631107be51 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -75,7 +75,6 @@ #define SCAN_NOSKIP 0x1 /* Don't skip blanks. */ #define SCAN_SUPPRESS 0x2 /* Suppress assignment. */ #define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */ -#define SCAN_WIDTH 0x8 /* A width value was supplied. */ #define SCAN_SIGNOK 0x10 /* A +/- character is allowed. */ #define SCAN_NODIGITS 0x20 /* No digits have been scanned. */ @@ -299,21 +298,18 @@ static void ReleaseCharSet(CharSet *cset) * *---------------------------------------------------------------------- */ -static int ValidateFormat(const zend_string *zstr_format, uint32_t format_arg_num, uint32_t numVars, uint32_t *totalSubs) +static bool isFormatStringValid(const zend_string *zstr_format, uint32_t format_arg_num, uint32_t numVars, uint32_t *totalSubs) { #define STATIC_LIST_SIZE 16 - int flags; bool gotXpg = false; bool gotSequential = false; - const char *ch = NULL; uint32_t staticAssign[STATIC_LIST_SIZE]; uint32_t *nassign = staticAssign; uint32_t objIndex = 0; uint32_t xpgSize = 0; uint32_t nspace = STATIC_LIST_SIZE; - zend_ulong value; + bool bindToVariables = numVars; - bool assignToVariables = numVars; /* * Initialize an array that records the number of times a variable * is assigned to by the format string. We use this to detect if @@ -325,100 +321,129 @@ static int ValidateFormat(const zend_string *zstr_format, uint32_t format_arg_nu } memset(nassign, 0, sizeof(uint32_t)*numVars); - const char *format = ZSTR_VAL(zstr_format); - while (*format != '\0') { - ch = format++; - flags = 0; - - if (*ch != '%') { + const char *end_ptr = ZSTR_VAL(zstr_format) + ZSTR_LEN(zstr_format); + for (const char *ptr = ZSTR_VAL(zstr_format); ptr < end_ptr; ptr++) { + bool isCurrentSpecifierBound = true; + /* Look for specifier start */ + if (*ptr != '%') { continue; } - ch = format++; - if (*ch == '%') { - continue; + ptr++; + + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; } - if (*ch == '*') { - flags |= SCAN_SUPPRESS; - ch = format++; - goto xpgCheckDone; + + /* Literal % so continue */ + if (*ptr == '%') { + continue; + } else if (*ptr == '*') { + /* Consumed specifier but not assigned to variable */ + isCurrentSpecifierBound = false; + ptr++; + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; + } } - if ( isdigit( (int)*ch ) ) { - /* - * Check for an XPG3-style %n$ specification. Note: there - * must not be a mixture of XPG3 specs and non-XPG3 specs + if (isdigit(*ptr)) { + /* We might either have an XPG3-style %n$ specification, + * or we are parsing the _maximum field width_ of the specifier. + * + * Note: there must not be a mixture of XPG3 specs and non-XPG3 specs * in the same format string. */ - char *end = NULL; - value = ZEND_STRTOUL(format-1, &end, 10); - if (*end != '$') { - goto notXpg; - } - format = end+1; - ch = format++; - gotXpg = true; - if (gotSequential) { - goto mixedXPG; + + char *width_end = NULL; + zend_ulong width = ZEND_STRTOUL(ptr, &width_end, 10); + if (UNEXPECTED(width_end == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; } - if ((value < 1) || (assignToVariables && (value > numVars))) { - goto badIndex; - } else if (!assignToVariables) { - /* - * In the case where no vars are specified, the user can - * specify %9999$ legally, so we have to consider special - * rules for growing the assign array. 'value' is - * guaranteed to be > 0. - */ + ptr = width_end; - /* set a lower artificial limit on this - * in the interest of security and resource friendliness - * 255 arguments should be more than enough. - cc - */ - if (value > SCAN_MAX_ARGS) { - goto badIndex; + if (*ptr != '$' && isCurrentSpecifierBound) { + gotSequential = true; + } else { + /* We indeed have an XPG3 style spec */ + ptr++; + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; + } + if (UNEXPECTED(gotSequential)) { + zend_argument_value_error(format_arg_num, "cannot mix \"%%\" and \"%%n$\" conversion specifiers"); + goto error; } - xpgSize = (xpgSize > value) ? xpgSize : value; - } - objIndex = value - 1; - goto xpgCheckDone; - } + zend_ulong argument_index = width; + gotXpg = true; -notXpg: - gotSequential = true; - if (gotXpg) { -mixedXPG: - zend_value_error("%s", "cannot mix \"%\" and \"%n$\" conversion specifiers"); - goto error; - } + if (UNEXPECTED(argument_index < 1 || (bindToVariables && argument_index > numVars))) { + zend_argument_value_error(format_arg_num, "argument index %%%" ZEND_ULONG_FMT_SPEC "$ is out of range", argument_index); + goto error; + } else if (!bindToVariables) { + /* + * In the case where no vars are specified, the user can + * specify %9999$ legally, so we have to consider special + * rules for growing the assign array. 'value' is + * guaranteed to be > 0. + */ -xpgCheckDone: - /* - * Parse any width specifier. - */ - if (isdigit(UCHAR(*ch))) { - char *end = NULL; - value = ZEND_STRTOUL(format-1, &end, 10); - flags |= SCAN_WIDTH; - format = end; - ch = format++; + /* set a lower artificial limit on this + * in the interest of security and resource friendliness + * 255 arguments should be more than enough. - cc + */ + if (argument_index > SCAN_MAX_ARGS) { + // TODO Specify limit? + zend_argument_value_error(format_arg_num, "argument index %%%" ZEND_ULONG_FMT_SPEC "$ is out of range", argument_index); + goto error; + } + + xpgSize = MAX(argument_index, xpgSize); + } + objIndex = argument_index - 1; + + /* Check if we have a width argument with the XPG3 specifier */ + if (!isdigit(*ptr)) { + goto length_modifier; + } + /* Grab the width to be able to continue */ + width = ZEND_STRTOUL(ptr, &width_end, 10); + if (UNEXPECTED(width_end == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; + } + ptr = width_end; + } + } else if (isCurrentSpecifierBound) { + if (UNEXPECTED(gotXpg)) { + zend_argument_value_error(format_arg_num, "cannot mix \"%%\" and \"%%n$\" conversion specifiers"); + goto error; + } + gotSequential = true; } - /* - * Ignore size specifier. - */ - if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) { - ch = format++; +length_modifier: + /* Ignore length modifier */ + if (*ptr == 'l' || *ptr == 'L' || *ptr == 'h') { + ptr++; + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; + } } - if (!(flags & SCAN_SUPPRESS) && assignToVariables && (objIndex >= numVars)) { - goto badIndex; + if (isCurrentSpecifierBound && bindToVariables && (objIndex >= numVars)) { + zend_argument_value_error(format_arg_num, "Different numbers of variable names and field specifiers"); + goto error; } - /* - * Handle the various field types. - */ - switch (*ch) { + /* Handle specifiers */ + ZEND_ASSERT(ptr != end_ptr); + switch (*ptr) { case 'n': case 'd': case 'D': @@ -440,48 +465,44 @@ static int ValidateFormat(const zend_string *zstr_format, uint32_t format_arg_nu /* ANSI. since Zend auto allocates space for vars, this is no */ /* problem - cc */ /* - if (flags & SCAN_WIDTH) { - php_error_docref(NULL, E_WARNING, "Field width may not be specified in %c conversion"); + if (hasFieldWidth) { + php_error_docref(NULL, E_WARNING, "Field width may not be specified in %%c conversion"); goto error; } */ break; + /* Range specifier */ case '[': - if (*format == '\0') { - goto badSet; - } - ch = format++; - if (*ch == '^') { - if (*format == '\0') { - goto badSet; + ptr++; + /* Not match flag */ + if (*ptr == '^') { + ptr++; + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated [ format specifier"); + goto error; } - ch = format++; } - if (*ch == ']') { - if (*format == '\0') { - goto badSet; - } - ch = format++; + /* If ] is the first character of the range it means it should be *included* + * in the range and not mark the end of it (as it would be empty otherwise) */ + if (*ptr == ']') { + ptr++; } - while (*ch != ']') { - if (*format == '\0') { - goto badSet; + while (*ptr != ']') { + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated [ format specifier"); + goto error; } - ch = format++; + ptr++; } break; -badSet: - zend_value_error("Unmatched [ in format string"); - goto error; - default: { - zend_value_error("Bad scan conversion character \"%c\"", *ch); + default: + zend_argument_value_error(format_arg_num, "unknown format specifier \"%c\"", *ptr); goto error; - } } - if (!(flags & SCAN_SUPPRESS)) { + if (isCurrentSpecifierBound) { if (objIndex >= nspace) { /* * Expand the nassign buffer. If we are using XPG specifiers, @@ -509,12 +530,12 @@ static int ValidateFormat(const zend_string *zstr_format, uint32_t format_arg_nu nassign[objIndex]++; objIndex++; } - } /* while (*format != '\0') */ + } /* * Verify that all of the variable were assigned exactly once. */ - if (!assignToVariables) { + if (!bindToVariables) { if (xpgSize) { numVars = xpgSize; } else { @@ -526,35 +547,38 @@ static int ValidateFormat(const zend_string *zstr_format, uint32_t format_arg_nu for (uint32_t i = 0; i < numVars; i++) { if (nassign[i] > 1) { - zend_value_error("%s", "Variable is assigned by multiple \"%n$\" conversion specifiers"); + if (bindToVariables) { + /* +1 as arguments are 1-indexed not 0-indexed */ + zend_argument_value_error(i + 1 + format_arg_num, "is assigned by multiple \"%%n$\" conversion specifiers"); + } else { + zend_argument_value_error(format_arg_num, "argument %" PRIu32 " is assigned by multiple \"%%n$\" conversion specifiers", i+1); + } goto error; } else if (!xpgSize && (nassign[i] == 0)) { /* * If the space is empty, and xpgSize is 0 (means XPG wasn't * used, and/or numVars != 0), then too many vars were given */ - zend_value_error("Variable is not assigned by any conversion specifiers"); + if (bindToVariables) { + /* +1 as arguments are 1-indexed not 0-indexed */ + zend_argument_value_error(i + 1 + format_arg_num, "is not assigned by any conversion specifiers"); + } else { + zend_argument_value_error(format_arg_num, "argument %" PRIu32 " is not assigned by any conversion specifiers", i+1); + } goto error; } } if (nassign != staticAssign) { - efree((char *)nassign); - } - return SCAN_SUCCESS; - -badIndex: - if (gotXpg) { - zend_value_error("%s", "\"%n$\" argument index out of range"); - } else { - zend_value_error("Different numbers of variable names and field specifiers"); + efree(nassign); } + return true; error: if (nassign != staticAssign) { - efree((char *)nassign); + efree(nassign); } - return SCAN_ERROR_INVALID_FORMAT; + return false; #undef STATIC_LIST_SIZE } /* }}} */ @@ -602,8 +626,8 @@ PHPAPI int php_sscanf_internal(const char *string, const zend_string *zstr_forma * Check for errors in the format string. */ uint32_t totalVars = 0; - if (ValidateFormat(zstr_format, format_arg_num, numVars, &totalVars) != SCAN_SUCCESS) { - scan_set_error_return( assignToVariables, return_value ); + /* Throws when format is invalid */ + if (!isFormatStringValid(zstr_format, format_arg_num, numVars, &totalVars)) { return SCAN_ERROR_INVALID_FORMAT; } diff --git a/ext/standard/tests/file/fscanf/fscanf.phpt b/ext/standard/tests/file/fscanf/fscanf.phpt index 4acadc6169b0d..4614339e2c87f 100644 --- a/ext/standard/tests/file/fscanf/fscanf.phpt +++ b/ext/standard/tests/file/fscanf/fscanf.phpt @@ -80,15 +80,15 @@ int(0) NULL int(1) string(4) "data" -Variable is not assigned by any conversion specifiers +fscanf(): Argument #4 is not assigned by any conversion specifiers string(4) "data" NULL -Variable is not assigned by any conversion specifiers +fscanf(): Argument #3 is not assigned by any conversion specifiers array(0) { } array(0) { } -Bad scan conversion character "." +fscanf(): Argument #2 ($format) unknown format specifier "." array(0) { } array(0) { @@ -96,5 +96,5 @@ array(0) { bool(false) array(0) { } -Different numbers of variable names and field specifiers +fscanf(): Argument #2 ($format) Different numbers of variable names and field specifiers Done diff --git a/ext/standard/tests/file/fscanf/fscanf_error.phpt b/ext/standard/tests/file/fscanf/fscanf_error.phpt index da586555be06c..a35884894c68b 100644 --- a/ext/standard/tests/file/fscanf/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_error.phpt @@ -58,12 +58,12 @@ unlink($filename); --EXPECT-- *** Testing fscanf() for error conditions *** fscanf(): supplied resource is not a valid File-Handle resource -Different numbers of variable names and field specifiers +fscanf(): Argument #2 ($format) Different numbers of variable names and field specifiers array(0) { } -Bad scan conversion character " -Bad scan conversion character " -Bad scan conversion character "." -Bad scan conversion character "m" +fscanf(): Argument #2 ($format) unterminated format specifier +fscanf(): Argument #2 ($format) unterminated format specifier +fscanf(): Argument #2 ($format) unknown format specifier "." +fscanf(): Argument #2 ($format) unknown format specifier "m" *** Done *** diff --git a/ext/standard/tests/strings/scanf/gh15552.phpt b/ext/standard/tests/strings/scanf/gh15552.phpt index 60804e025d862..961e87e95e140 100644 --- a/ext/standard/tests/strings/scanf/gh15552.phpt +++ b/ext/standard/tests/strings/scanf/gh15552.phpt @@ -2,8 +2,12 @@ Bug GH-15552 (Signed integer overflow in ext/standard/scanf.c) --FILE-- getMessage(), PHP_EOL; +} ?> ---EXPECTF-- -Fatal error: Uncaught ValueError: "%n$" argument index out of range in %s:%d -Stack trace:%A +--EXPECT-- +ValueError: sscanf(): Argument #2 ($format) argument index %2147483648$ is out of range diff --git a/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt b/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt index ca886153f6979..0c8c6258de05d 100644 --- a/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt +++ b/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt @@ -18,8 +18,15 @@ try { } ?> --EXPECT-- -array(1) { +array(3) { [0]=> string(5) "Hello" + [1]=> + NULL + [2]=> + NULL } -ValueError: Variable is not assigned by any conversion specifiers +int(1) +string(5) "Hello" +NULL +NULL diff --git a/ext/standard/tests/strings/scanf/sscanf_error.phpt b/ext/standard/tests/strings/scanf/sscanf_error.phpt index e04b5e2cbb625..bc118ff65c98c 100644 --- a/ext/standard/tests/strings/scanf/sscanf_error.phpt +++ b/ext/standard/tests/strings/scanf/sscanf_error.phpt @@ -20,4 +20,4 @@ try { *** Testing sscanf() : error conditions *** -- Testing sscanf() function with more than expected no. of arguments -- -Variable is not assigned by any conversion specifiers +sscanf(): Argument #5 is not assigned by any conversion specifiers diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt index 30b2008f79ab1..fe3096a72932b 100644 --- a/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt @@ -30,8 +30,8 @@ foreach ($formats as $format) { ?> --EXPECT-- Using format string '%1$s %2$s %1$s': -ValueError: Variable is assigned by multiple "%n$" conversion specifiers -ValueError: Variable is assigned by multiple "%n$" conversion specifiers +ValueError: sscanf(): Argument #2 ($format) argument 1 is assigned by multiple "%n$" conversion specifiers +ValueError: sscanf(): Argument #3 is assigned by multiple "%n$" conversion specifiers Using format string '%1$s %*s %3$s': array(3) { [0]=> @@ -41,7 +41,7 @@ array(3) { [2]=> NULL } -ValueError: Variable is not assigned by any conversion specifiers +ValueError: sscanf(): Argument #4 is not assigned by any conversion specifiers Using format string '%s %*s %3$s': -ValueError: cannot mix "%" and "%n$" conversion specifiers -ValueError: cannot mix "%" and "%n$" conversion specifiers +ValueError: sscanf(): Argument #2 ($format) cannot mix "%" and "%n$" conversion specifiers +ValueError: sscanf(): Argument #2 ($format) cannot mix "%" and "%n$" conversion specifiers diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt index 9dc22b46c8912..27cc4f844263f 100644 --- a/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt @@ -36,10 +36,10 @@ foreach ($formats as $format) { ?> --EXPECT-- Using format string '%[': -ValueError: Unmatched [ in format string +ValueError: sscanf(): Argument #2 ($format) unterminated [ format specifier Using format string '%[]': -ValueError: Unmatched [ in format string +ValueError: sscanf(): Argument #2 ($format) unterminated [ format specifier Using format string '%[^': -ValueError: Unmatched [ in format string +ValueError: sscanf(): Argument #2 ($format) unterminated [ format specifier Using format string '%[^]': -ValueError: Unmatched [ in format string +ValueError: sscanf(): Argument #2 ($format) unterminated [ format specifier diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt index 7ff50335a575d..ea2011288cbee 100644 --- a/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt @@ -38,34 +38,34 @@ foreach ($formats as $format) { ?> --EXPECT-- Using format string '%': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%L': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%2': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%2L': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%1$': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%1$L': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%1$2': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%1$2L': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%*': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%*L': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%*2': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%*2L': -ValueError: Bad scan conversion character " +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%*1$': -ValueError: Bad scan conversion character "$" +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%*1$L': -ValueError: Bad scan conversion character "$" +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%*1$2': -ValueError: Bad scan conversion character "$" +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier Using format string '%*1$2L': -ValueError: Bad scan conversion character "$" +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier From 4730501386e5ba7cacbde6f5670e389353ead51a Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Wed, 10 Dec 2025 23:41:53 +0000 Subject: [PATCH 30/31] ext/standard: pass string length --- ext/spl/spl_directory.c | 2 +- ext/standard/file.c | 2 +- ext/standard/scanf.c | 2 +- ext/standard/scanf.h | 2 +- ext/standard/string.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index b0d540bf423e7..865ce15386ab1 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2494,7 +2494,7 @@ PHP_METHOD(SplFileObject, fscanf) RETURN_THROWS(); } - php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), format_str, 1, num_varargs, varargs, return_value); + php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_LEN(intern->u.file.current_line), format_str, 1, num_varargs, varargs, return_value); } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index 0d9c43f2b3107..cdce0d0f84d7d 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -956,7 +956,7 @@ PHP_FUNCTION(fscanf) RETURN_FALSE; } - php_sscanf_internal(buf, format, 2, argc, args, return_value); + php_sscanf_internal(buf, len, format, 2, argc, args, return_value); efree(buf); } diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index e25631107be51..99f68cc7af73b 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -595,7 +595,7 @@ static bool isFormatStringValid(const zend_string *zstr_format, uint32_t format_ * return_value set with the results of the scan */ -PHPAPI int php_sscanf_internal(const char *string, const zend_string *zstr_format, uint32_t format_arg_num, +PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend_string *zstr_format, uint32_t format_arg_num, uint32_t argCount, zval *args, zval *return_value) { diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index 1bfa4707d0aae..869e6e94fd4f3 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -33,7 +33,7 @@ * The following are here solely for the benefit of the scanf type functions * e.g. fscanf */ -PHPAPI int php_sscanf_internal(const char *string, const zend_string *format, uint32_t format_arg_num, uint32_t argCount, zval *args, +PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend_string *format, uint32_t format_arg_num, uint32_t argCount, zval *args, zval *return_value); diff --git a/ext/standard/string.c b/ext/standard/string.c index 887192d2dd311..1ad9bc588831e 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5871,7 +5871,7 @@ PHP_FUNCTION(sscanf) Z_PARAM_VARIADIC('*', args, num_args) ZEND_PARSE_PARAMETERS_END(); - php_sscanf_internal(str, format, 2, num_args, args, return_value); + php_sscanf_internal(str, str_len, format, 2, num_args, args, return_value); } /* }}} */ From ab81474c00fd59166ad91179512703e4809c9509 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 11 Dec 2025 01:47:31 +0000 Subject: [PATCH 31/31] ext/standard/scanf.c: Refactor parsing and scanning --- ext/standard/scanf.c | 594 ++++++------------ .../tests/file/fscanf/fscanf_variation14.phpt | 58 +- .../strings/scanf/sscanf_binary_strings.phpt | 10 +- 3 files changed, 238 insertions(+), 424 deletions(-) diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 99f68cc7af73b..9c0f8ab352ee4 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -583,6 +583,13 @@ static bool isFormatStringValid(const zend_string *zstr_format, uint32_t format_ } /* }}} */ +enum php_scan_op { + SCAN_STRING, + SCAN_INTEGER, + SCAN_FLOAT, + SCAN_RANGE +}; + /* {{{ php_sscanf_internal * This is the internal function which does processing on behalf of * both sscanf() and fscanf() @@ -601,19 +608,11 @@ PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend { int numVars, nconversions; int result; - zend_long value; zend_ulong objIndex; - const char *end; const char *baseString; zval *current; - char op = 0; int base = 0; - int underflow = 0; - size_t width; int_string_formater fn = NULL; - const char *ch; - char sch; - int flags; numVars = argCount; if (numVars < 0) { @@ -671,90 +670,90 @@ PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend nconversions = 0; /* note ! - we need to limit the loop for objIndex to keep it in bounds */ - const char *format = ZSTR_VAL(zstr_format); - while (*format != '\0') { - ch = format++; - flags = 0; - - /* - * If we see whitespace in the format, skip whitespace in the string. - */ - if ( isspace( (int)*ch ) ) { - sch = *string; - while ( isspace( (int)sch ) ) { - if (*string == '\0') { - goto done; + bool is_fully_consumed = true; + const char *end_string_ptr = string + string_len; + const char *end_format_ptr = ZSTR_VAL(zstr_format) + ZSTR_LEN(zstr_format); + for (const char *format = ZSTR_VAL(zstr_format); format < end_format_ptr; format++) { + bool isCurrentSpecifierBound = true; + zend_ulong width = 0; + /* Whitespace in format => gobble up all whitespace in the string */ + if (isspace(*format)) { + while (isspace(*string)) { + if (string == end_string_ptr) { + goto new_done; } string++; - sch = *string; } continue; - } - - if (*ch != '%') { -literal: - if (*string == '\0') { - underflow = 1; - goto done; + } else if (*format != '%') { +new_literal: + if (string == end_string_ptr) { + is_fully_consumed = false; + goto new_done; } - sch = *string; - string++; - if (*ch != sch) { - goto done; + /* String doesn't match format */ + if (*string != *format) { + goto new_done; } + string++; continue; + } else { + ZEND_ASSERT(*format == '%'); + format++; } - ch = format++; - if (*ch == '%') { - goto literal; + /* %% sequence wants to check for a single % in the string */ + if (*format == '%') { + goto new_literal; + } else if (*format == '*') { + /* Consumed specifier but not assigned to variable */ + isCurrentSpecifierBound = false; + format++; } - /* - * Check for assignment suppression ('*') or an XPG3-style - * assignment ('%n$'). - */ - if (*ch == '*') { - flags |= SCAN_SUPPRESS; - ch = format++; - } else if ( isdigit(UCHAR(*ch))) { - char *end = NULL; - zend_ulong assignment_index = ZEND_STRTOUL(format-1, &end, 10); - if (*end == '$') { - format = end+1; - ch = format++; - objIndex = assignment_index - 1; - } - } + if (isdigit(*format)) { + /* We might either have an XPG3-style %n$ specification, + * or we are parsing the _maximum field width_ of the specifier. + * + * Note: there must not be a mixture of XPG3 specs and non-XPG3 specs + * in the same format string. + */ - /* - * Parse any width specifier. - */ - if ( isdigit(UCHAR(*ch))) { - char *end_ptr = NULL; - width = ZEND_STRTOUL(format-1, &end_ptr, 10); - format = end_ptr; - ch = format++; - } else { - width = 0; + char *width_end = NULL; + width = ZEND_STRTOUL(format, &width_end, 10); + format = width_end; + + if (*format == '$') { + /* We indeed have an XPG3 style spec */ + format++; + zend_ulong argument_index = width; + width = 0; + objIndex = argument_index - 1; + + /* Check if we have a width argument with the XPG3 specifier */ + if (!isdigit(*format)) { + goto length_modifier; + } + /* Grab the width to be able to continue */ + width = ZEND_STRTOUL(format, &width_end, 10); + format = width_end; + } } - /* - * Ignore size specifier. - */ - if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) { - ch = format++; +length_modifier: + /* Ignore length modifier */ + if (*format == 'l' || *format == 'L' || *format == 'h') { + format++; } - /* - * Handle the various field types. - */ - switch (*ch) { - case 'n': - if (!(flags & SCAN_SUPPRESS)) { - if (assignToVariables && objIndex >= argCount) { - break; - } else if (assignToVariables) { + bool read_unsigned_integer = false; + bool preserve_whitespace = false; + enum php_scan_op op; + switch (*format) { + case 'n': { + // TODO: Warn if this situation arises in format string? + if (isCurrentSpecifierBound) { + if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_LONG(current, (zend_long) (string - baseString)); } else { @@ -763,33 +762,34 @@ PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend } nconversions++; continue; + } case 'd': case 'D': - op = 'i'; + op = SCAN_INTEGER; base = 10; fn = (int_string_formater)ZEND_STRTOL_PTR; break; case 'i': - op = 'i'; + op = SCAN_INTEGER; base = 0; fn = (int_string_formater)ZEND_STRTOL_PTR; break; case 'o': - op = 'i'; + op = SCAN_INTEGER; base = 8; fn = (int_string_formater)ZEND_STRTOL_PTR; break; case 'x': case 'X': - op = 'i'; + op = SCAN_INTEGER; base = 16; fn = (int_string_formater)ZEND_STRTOL_PTR; break; case 'u': - op = 'i'; + op = SCAN_INTEGER; base = 10; - flags |= SCAN_UNSIGNED; + read_unsigned_integer = true; fn = (int_string_formater)ZEND_STRTOUL_PTR; break; @@ -797,16 +797,16 @@ PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend case 'e': case 'E': case 'g': - op = 'f'; + op = SCAN_FLOAT; break; case 's': - op = 's'; + op = SCAN_STRING; break; case 'c': - op = 's'; - flags |= SCAN_NOSKIP; + op = SCAN_STRING; + preserve_whitespace = true; /*-cc-*/ if (0 == width) { width = 1; @@ -814,270 +814,125 @@ PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend /*-cc-*/ break; case '[': - op = '['; - flags |= SCAN_NOSKIP; + op = SCAN_RANGE; + preserve_whitespace = true; break; - } /* switch */ - - /* - * At this point, we will need additional characters from the - * string to proceed. - */ - if (*string == '\0') { - underflow = 1; - goto done; } - /* - * Skip any leading whitespace at the beginning of a field unless - * the format suppresses this behavior. - */ - if (!(flags & SCAN_NOSKIP)) { - while (*string != '\0') { - sch = *string; - if (! isspace((int)sch) ) { - break; - } + /* Unless the specifier preserves whitespace, ignore whitespace in string */ + if (!preserve_whitespace) { + while (string != end_string_ptr && isspace(*string)) { string++; } - if (*string == '\0') { - underflow = 1; - goto done; - } } - /* - * Perform the requested scanning operation. - */ + /* Check that we are not at the end of the string, as we need to consume bytes to satisfy the specifier + * Note: this cannot be checked before due to the %n specifier */ + if (string == end_string_ptr) { + is_fully_consumed = false; + goto new_done; + } + ZEND_ASSERT(string != end_string_ptr); + switch (op) { - case 'c': - case 's': - /* - * Scan a string up to width characters or whitespace. - */ + /* Scan a string up to width characters or whitespace. */ + case SCAN_STRING: { if (width == 0) { - width = (size_t) ~0; - } - end = string; - while (*end != '\0') { - sch = *end; - if ( isspace( (int)sch ) ) { + /* We should be using uz/zu but does not exist in C yet + * https://thephd.dev/_vendor/future_cxx/papers/C%20-%20Literal%20Suffixes%20for%20size_t.html */ + width = ~0u; + } + const char *start = string; + while (string != end_string_ptr) { + /* Consider nul byte as whitespace here */ + if (isspace(*string) || *string == '\0' || width-- == 0) { break; } - end++; - if (--width == 0) { - break; - } + string++; } - if (!(flags & SCAN_SUPPRESS)) { - if (assignToVariables && objIndex >= argCount) { - break; - } else if (assignToVariables) { + if (isCurrentSpecifierBound) { + if (assignToVariables) { current = args + objIndex++; - ZEND_TRY_ASSIGN_REF_STRINGL(current, string, end - string); + ZEND_TRY_ASSIGN_REF_STRINGL(current, start, string-start); } else { - add_index_stringl(return_value, objIndex++, string, end-string); + add_index_stringl(return_value, objIndex++, start, string-start); } } - string = end; break; + } - case '[': { - CharSet cset; - + case SCAN_RANGE: { if (width == 0) { - width = (size_t) ~0; + /* We should be using uz/zu but does not exist in C yet + * https://thephd.dev/_vendor/future_cxx/papers/C%20-%20Literal%20Suffixes%20for%20size_t.html */ + width = ~0u; } - end = string; + format++; + CharSet cset; + const char *start = string; format = BuildCharSet(&cset, format); - while (*end != '\0') { - sch = *end; - if (!CharInSet(&cset, sch)) { - break; - } - end++; - if (--width == 0) { + while (string != end_string_ptr) { + if (!CharInSet(&cset, *string) || width-- == 0) { break; } + string++; } ReleaseCharSet(&cset); - if (string == end) { - /* - * Nothing matched the range, stop processing - */ - goto done; + /* Nothing matched the range, stop processing */ + if (UNEXPECTED(string == start)) { + //is_fully_consumed = false; + goto new_done; } - if (!(flags & SCAN_SUPPRESS)) { - if (assignToVariables && objIndex >= argCount) { - break; - } else if (assignToVariables) { + if (isCurrentSpecifierBound) { + if (assignToVariables) { current = args + objIndex++; - ZEND_TRY_ASSIGN_REF_STRINGL(current, string, end - string); + ZEND_TRY_ASSIGN_REF_STRINGL(current, start, string-start); } else { - add_index_stringl(return_value, objIndex++, string, end-string); + add_index_stringl(return_value, objIndex++, start, string-start); } } - string = end; break; } -/* - case 'c': - / Scan a single character./ - - sch = *string; - string++; - if (!(flags & SCAN_SUPPRESS)) { - if (assignToVariables) { - char __buf[2]; - __buf[0] = sch; - __buf[1] = '\0'; - current = args[objIndex++]; - zval_ptr_dtor_nogc(*current); - ZVAL_STRINGL( *current, __buf, 1); - } else { - add_index_stringl(return_value, objIndex++, &sch, 1); - } - } - break; -*/ - case 'i': { - /* Temporary buffer to hold scanned number */ - char buf[64]; - char *buf_end; - /* - * Scan an unsigned or signed integer. - */ - /*-cc-*/ - buf[0] = '\0'; - /*-cc-*/ - if ((width == 0) || (width > sizeof(buf) - 1)) { - width = sizeof(buf) - 1; - } - - flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO; - for (buf_end = buf; width > 0; width--) { - switch (*string) { - /* - * The 0 digit has special meaning at the beginning of - * a number. If we are unsure of the base, it - * indicates that we are in base 8 or base 16 (if it is - * followed by an 'x'). - */ - case '0': - /*-cc-*/ - if (base == 16) { - flags |= SCAN_XOK; - } - /*-cc-*/ - if (base == 0) { - base = 8; - flags |= SCAN_XOK; - } - if (flags & SCAN_NOZERO) { - flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO); - } else { - flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); - } - goto addToInt; - - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': - if (base == 0) { - base = 10; - } - flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); - goto addToInt; - - case '8': case '9': - if (base == 0) { - base = 10; - } - if (base <= 8) { - break; - } - flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); - goto addToInt; - - case 'A': case 'B': case 'C': - case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': - case 'd': case 'e': case 'f': - if (base <= 10) { - break; - } - flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); - goto addToInt; - - case '+': case '-': - if (flags & SCAN_SIGNOK) { - flags &= ~SCAN_SIGNOK; - goto addToInt; - } - break; - - case 'x': case 'X': - if ((flags & SCAN_XOK) && (buf_end == buf+1)) { - base = 16; - flags &= ~SCAN_XOK; - goto addToInt; - } - break; - } - - /* - * We got an illegal character so we are done accumulating. - */ - break; - -addToInt: - /* - * Add the character to the temporary buffer. - */ - *buf_end++ = *string++; - if (*string == '\0') { - break; - } - } - - /* - * Check to see if we need to back up because we only got a - * sign or a trailing x after a 0. - */ - if (flags & SCAN_NODIGITS) { - if (*string == '\0') { - underflow = 1; - } - goto done; - } else if (buf_end[-1] == 'x' || buf_end[-1] == 'X') { - buf_end--; - string--; - } + case SCAN_INTEGER: { + ZEND_ASSERT(fn != NULL && "must have a valid strto{int} function"); + bool release_buffer = false; + char *buf = (char*)string; + if (width != 0) { + width = MIN(end_string_ptr-string, width); + buf = estrndup(string, width); + release_buffer = true; + } + char *int_end = NULL; + zend_long value = (*fn)(buf, &int_end, base); + ptrdiff_t l = int_end - buf; + if (release_buffer) { + efree(buf); + } + /* Did not parse an integer */ + if (l == 0) { + //is_fully_consumed = false; + goto new_done; + } + string += l; /* - * Scan the value from the temporary buffer. If we are - * returning a large unsigned value, we have to convert it back + * If we are returning a large unsigned value, we have to convert it back * to a string since PHP only supports signed values. - */ - if (!(flags & SCAN_SUPPRESS)) { - *buf_end = '\0'; - value = (zend_long) (*fn)(buf, NULL, base); - if ((flags & SCAN_UNSIGNED) && (value < 0)) { - snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, value); /* INTL: ISO digit */ - if (assignToVariables && objIndex >= argCount) { - break; - } else if (assignToVariables) { - /* change passed value type to string */ + */ + if (isCurrentSpecifierBound) { + if (read_unsigned_integer && UNEXPECTED(value < 0)) { + zend_string *uint_str = strpprintf(0, ZEND_ULONG_FMT, value); + if (assignToVariables) { current = args + objIndex++; - ZEND_TRY_ASSIGN_REF_STRING(current, buf); + ZEND_TRY_ASSIGN_REF_STR(current, uint_str); } else { - add_index_string(return_value, objIndex++, buf); + add_index_str(return_value, objIndex++, uint_str); } + // TODO Need to free? } else { - if (assignToVariables && objIndex >= argCount) { - break; - } else if (assignToVariables) { + if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_LONG(current, value); } else { @@ -1088,104 +943,29 @@ PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend break; } - case 'f': { - /* Temporary buffer to hold scanned number */ - char buf[64]; - char *buf_end; - /* - * Scan a floating point number - */ - buf[0] = '\0'; /* call me pedantic */ - if ((width == 0) || (width > sizeof(buf) - 1)) { - width = sizeof(buf) - 1; + case SCAN_FLOAT: { + bool release_buffer = false; + char *buf = (char*)string; + if (width != 0) { + width = MIN(end_string_ptr-string, width); + buf = estrndup(string, width); + release_buffer = true; } - flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_PTOK | SCAN_EXPOK; - for (buf_end = buf; width > 0; width--) { - switch (*string) { - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': - flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS); - goto addToFloat; - case '+': - case '-': - if (flags & SCAN_SIGNOK) { - flags &= ~SCAN_SIGNOK; - goto addToFloat; - } - break; - case '.': - if (flags & SCAN_PTOK) { - flags &= ~(SCAN_SIGNOK | SCAN_PTOK); - goto addToFloat; - } - break; - case 'e': - case 'E': - /* - * An exponent is not allowed until there has - * been at least one digit. - */ - if ((flags & (SCAN_NODIGITS | SCAN_EXPOK)) == SCAN_EXPOK) { - flags = (flags & ~(SCAN_EXPOK|SCAN_PTOK)) - | SCAN_SIGNOK | SCAN_NODIGITS; - goto addToFloat; - } - break; - } - - /* - * We got an illegal character so we are done accumulating. - */ - break; - -addToFloat: - /* - * Add the character to the temporary buffer. - */ - *buf_end++ = *string++; - if (*string == '\0') { - break; - } + const char *float_end = NULL; + double dvalue = zend_strtod(buf, &float_end); + ptrdiff_t l = float_end - buf; + if (release_buffer) { + efree(buf); } - - /* - * Check to see if we need to back up because we saw a - * trailing 'e' or sign. - */ - if (flags & SCAN_NODIGITS) { - if (flags & SCAN_EXPOK) { - /* - * There were no digits at all so scanning has - * failed and we are done. - */ - if (*string == '\0') { - underflow = 1; - } - goto done; - } - - /* - * We got a bad exponent ('e' and maybe a sign). - */ - buf_end--; - string--; - if (*buf_end != 'e' && *buf_end != 'E') { - buf_end--; - string--; - } + /* Did not parse a float */ + if (l == 0) { + //is_fully_consumed = false; + goto new_done; } + string += l; - /* - * Scan the value from the temporary buffer. - */ - if (!(flags & SCAN_SUPPRESS)) { - double dvalue; - *buf_end = '\0'; - dvalue = zend_strtod(buf, NULL); - if (assignToVariables && objIndex >= argCount) { - break; - } else if (assignToVariables) { + if (isCurrentSpecifierBound) { + if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_DOUBLE(current, dvalue); } else { @@ -1194,14 +974,14 @@ PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend } break; } - } /* switch (op) */ + } nconversions++; - } /* while (*format != '\0') */ + } +new_done: -done: result = SCAN_SUCCESS; - if (underflow && (0==nconversions)) { + if (!is_fully_consumed && 0 == nconversions) { scan_set_error_return( assignToVariables, return_value ); result = SCAN_ERROR_EOF; } else if (assignToVariables) { diff --git a/ext/standard/tests/file/fscanf/fscanf_variation14.phpt b/ext/standard/tests/file/fscanf/fscanf_variation14.phpt index a5bce1c7276f7..8c2a6ceeb5494 100644 --- a/ext/standard/tests/file/fscanf/fscanf_variation14.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation14.phpt @@ -121,7 +121,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -187,7 +190,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -253,7 +259,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -319,7 +328,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -385,7 +397,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -451,7 +466,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -517,7 +535,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -583,7 +604,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -649,7 +673,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -715,7 +742,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -790,7 +820,10 @@ array(1) { [0]=> NULL } -NULL +array(1) { + [0]=> + NULL +} array(1) { [0]=> NULL @@ -846,7 +879,8 @@ array(0) { array(0) { } NULL -NULL +array(0) { +} array(0) { } array(0) { diff --git a/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt b/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt index 0c8c6258de05d..4e34707adbc83 100644 --- a/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt +++ b/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt @@ -22,11 +22,11 @@ array(3) { [0]=> string(5) "Hello" [1]=> - NULL + string(9) "wonderful" [2]=> - NULL + string(6) "World!" } -int(1) +int(3) string(5) "Hello" -NULL -NULL +string(9) "wonderful" +string(6) "World!"