@@ -1934,6 +1934,7 @@ function run_test(string $php, $file, array $env): string
1934
1934
$ diff_filename = $ temp_dir . DIRECTORY_SEPARATOR . $ main_file_name . 'diff ' ;
1935
1935
$ log_filename = $ temp_dir . DIRECTORY_SEPARATOR . $ main_file_name . 'log ' ;
1936
1936
$ exp_filename = $ temp_dir . DIRECTORY_SEPARATOR . $ main_file_name . 'exp ' ;
1937
+ $ stdin_filename = $ temp_dir . DIRECTORY_SEPARATOR . $ main_file_name . 'stdin ' ;
1937
1938
$ output_filename = $ temp_dir . DIRECTORY_SEPARATOR . $ main_file_name . 'out ' ;
1938
1939
$ memcheck_filename = $ temp_dir . DIRECTORY_SEPARATOR . $ main_file_name . 'mem ' ;
1939
1940
$ sh_filename = $ temp_dir . DIRECTORY_SEPARATOR . $ main_file_name . 'sh ' ;
@@ -1972,6 +1973,7 @@ function run_test(string $php, $file, array $env): string
1972
1973
@unlink ($ diff_filename );
1973
1974
@unlink ($ log_filename );
1974
1975
@unlink ($ exp_filename );
1976
+ @unlink ($ stdin_filename );
1975
1977
@unlink ($ output_filename );
1976
1978
@unlink ($ memcheck_filename );
1977
1979
@unlink ($ sh_filename );
@@ -2696,6 +2698,16 @@ function run_test(string $php, $file, array $env): string
2696
2698
$ diff = generate_diff ($ wanted , $ wanted_re , $ output );
2697
2699
}
2698
2700
2701
+ // write .stdin
2702
+ if ($ test ->hasSection ('STDIN ' ) || $ test ->hasSection ('PHPDBG ' )) {
2703
+ $ stdin = $ test ->hasSection ('STDIN ' )
2704
+ ? $ test ->getSection ('STDIN ' )
2705
+ : $ test ->getSection ('PHPDBG ' ) . "\n" ;
2706
+ if (file_put_contents ($ stdin_filename , $ stdin ) === false ) {
2707
+ error ("Cannot create test stdin - $ stdin_filename " );
2708
+ }
2709
+ }
2710
+
2699
2711
if (is_array ($ IN_REDIRECT )) {
2700
2712
$ orig_shortname = str_replace (TEST_PHP_SRCDIR . '/ ' , '' , $ file );
2701
2713
$ diff = "# original source file: $ orig_shortname \n" . $ diff ;
0 commit comments