@@ -935,8 +935,12 @@ function save_or_mail_results(): void
935
935
$ PHP_FAILED_TESTS , $ php , $ output_file ;
936
936
937
937
/* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */
938
- if (!getenv ('NO_INTERACTION ' ) && !TRAVIS_CI ) {
939
- $ fp = fopen ("php://stdin " , "r+ " );
938
+ if (getenv ('NO_INTERACTION ' ) || TRAVIS_CI ) {
939
+ $ stdin = null ;
940
+ $ user_input = '' ;
941
+ }
942
+ else {
943
+ $ stdin = fopen ("php://stdin " , "r " );
940
944
if ($ sum_results ['FAILED ' ] || $ sum_results ['BORKED ' ] || $ sum_results ['WARNED ' ] || $ sum_results ['LEAKED ' ]) {
941
945
echo "\nYou may have found a problem in PHP. " ;
942
946
}
@@ -948,7 +952,7 @@ function save_or_mail_results(): void
948
952
echo "Do you want to send this report now? [Yns]: " ;
949
953
flush ();
950
954
951
- $ user_input = fgets ($ fp , 10 );
955
+ $ user_input = fgets ($ stdin , 10 );
952
956
$ just_save_results = (!empty ($ user_input ) && strtolower ($ user_input [0 ]) === 's ' );
953
957
}
954
958
@@ -967,10 +971,12 @@ function save_or_mail_results(): void
967
971
/* Ask the user to provide an email address, so that QA team can contact the user */
968
972
if (TRAVIS_CI ) {
969
973
$ user_email = 'travis at php dot net ' ;
974
+ } elseif ($ stdin === null ) {
975
+ $ user_email = null ;
970
976
} elseif (!strncasecmp ($ user_input , 'y ' , 1 ) || strlen (trim ($ user_input )) == 0 ) {
971
977
echo "\nPlease enter your email address. \n(Your address will be mangled so that it will not go out on any \nmailinglist in plain text): " ;
972
978
flush ();
973
- $ user_email = trim (fgets ($ fp , 1024 ));
979
+ $ user_email = trim (fgets ($ stdin , 1024 ));
974
980
$ user_email = str_replace ("@ " , " at " , str_replace (". " , " dot " , $ user_email ));
975
981
}
976
982
@@ -1052,8 +1058,8 @@ function save_or_mail_results(): void
1052
1058
1053
1059
echo "Please send " . $ output_file . " to " . PHP_QA_EMAIL . " manually, thank you. \n" ;
1054
1060
} elseif (!getenv ('NO_INTERACTION ' ) && !TRAVIS_CI ) {
1055
- fwrite ( $ fp , "\nThank you for helping to make PHP better. \n" ) ;
1056
- fclose ($ fp );
1061
+ echo "\nThank you for helping to make PHP better. \n" ;
1062
+ fclose ($ stdin );
1057
1063
}
1058
1064
}
1059
1065
}
@@ -1887,13 +1893,8 @@ function run_test(string $php, $file, array $env): string
1887
1893
$ org_file = $ file ;
1888
1894
$ orig_php = $ php ;
1889
1895
1890
- if (isset ($ env ['TEST_PHP_CGI_EXECUTABLE ' ])) {
1891
- $ php_cgi = $ env ['TEST_PHP_CGI_EXECUTABLE ' ];
1892
- }
1893
-
1894
- if (isset ($ env ['TEST_PHPDBG_EXECUTABLE ' ])) {
1895
- $ phpdbg = $ env ['TEST_PHPDBG_EXECUTABLE ' ];
1896
- }
1896
+ $ php_cgi = $ env ['TEST_PHP_CGI_EXECUTABLE ' ] ?? null ;
1897
+ $ phpdbg = $ env ['TEST_PHPDBG_EXECUTABLE ' ] ?? null ;
1897
1898
1898
1899
if (is_array ($ file )) {
1899
1900
$ file = $ file [0 ];
@@ -2574,6 +2575,8 @@ function run_test(string $php, $file, array $env): string
2574
2575
}
2575
2576
}
2576
2577
2578
+ $ wanted_headers = null ;
2579
+ $ output_headers = null ;
2577
2580
$ failed_headers = false ;
2578
2581
2579
2582
if ($ test ->hasSection ('EXPECTHEADERS ' )) {
@@ -2732,6 +2735,8 @@ function run_test(string $php, $file, array $env): string
2732
2735
}
2733
2736
}
2734
2737
2738
+ $ restype = [];
2739
+
2735
2740
if ($ leaked ) {
2736
2741
$ restype [] = $ test ->hasSection ('XLEAK ' ) ?
2737
2742
'XLEAK ' : 'LEAK ' ;
0 commit comments