@@ -1851,27 +1851,34 @@ function run_test($php, $file, $env)
1851
1851
// the redirect section allows a set of tests to be reused outside of
1852
1852
// a given test dir
1853
1853
if ($ bork_info === null ) {
1854
- if (isset ( $ section_text [ 'REDIRECTTEST ' ] )) {
1854
+ if (array_key_exists ( 'REDIRECTTEST ' , $ section_text )) {
1855
1855
1856
1856
if ($ IN_REDIRECT ) {
1857
1857
$ bork_info = "Can't redirect a test from within a redirected test " ;
1858
1858
}
1859
1859
1860
1860
} else {
1861
1861
1862
- if (!isset ($ section_text ['PHPDBG ' ]) && @count ($ section_text ['FILE ' ]) + @count ($ section_text ['FILEEOF ' ]) + @count ($ section_text ['FILE_EXTERNAL ' ]) != 1 ) {
1862
+ if (
1863
+ array_key_exists ('PHPDBG ' , $ section_text )
1864
+ && (
1865
+ array_key_exists ('FILE ' , $ section_text )
1866
+ xor array_key_exists ('FILEEOF ' , $ section_text )
1867
+ xor array_key_exists ('FILE_EXTERNAL ' , $ section_text )
1868
+ ) === false
1869
+ ) {
1863
1870
$ bork_info = "missing section --FILE-- " ;
1864
1871
}
1865
1872
1866
- if (isset ( $ section_text [ 'FILEEOF ' ] )) {
1873
+ if (array_key_exists ( 'FILEEOF ' , $ section_text )) {
1867
1874
$ section_text ['FILE ' ] = preg_replace ("/[ \r\n]+$/ " , '' , $ section_text ['FILEEOF ' ]);
1868
1875
unset($ section_text ['FILEEOF ' ]);
1869
1876
}
1870
1877
1871
1878
foreach (array ('FILE ' , 'EXPECT ' , 'EXPECTF ' , 'EXPECTREGEX ' ) as $ prefix ) {
1872
1879
$ key = $ prefix . '_EXTERNAL ' ;
1873
1880
1874
- if (isset ( $ section_text [ $ key] )) {
1881
+ if (array_key_exists ( $ key, $ section_text )) {
1875
1882
// don't allow tests to retrieve files from anywhere but this subdirectory
1876
1883
$ section_text [$ key ] = dirname ($ file ) . '/ ' . trim (str_replace ('.. ' , '' , $ section_text [$ key ]));
1877
1884
@@ -1884,7 +1891,13 @@ function run_test($php, $file, $env)
1884
1891
}
1885
1892
}
1886
1893
1887
- if ((@count ($ section_text ['EXPECT ' ]) + @count ($ section_text ['EXPECTF ' ]) + @count ($ section_text ['EXPECTREGEX ' ])) != 1 ) {
1894
+ if (
1895
+ (
1896
+ array_key_exists ('EXPECT ' , $ section_text )
1897
+ xor array_key_exists ('EXPECTF ' , $ section_text )
1898
+ xor array_key_exists ('EXPECTREGEX ' , $ section_text )
1899
+ ) === false
1900
+ ) {
1888
1901
$ bork_info = "missing section --EXPECT--, --EXPECTF-- or --EXPECTREGEX-- " ;
1889
1902
}
1890
1903
}
@@ -1908,7 +1921,7 @@ function run_test($php, $file, $env)
1908
1921
return 'BORKED ' ;
1909
1922
}
1910
1923
1911
- if (isset ( $ section_text [ 'CAPTURE_STDIO ' ] )) {
1924
+ if (array_key_exists ( 'CAPTURE_STDIO ' , $ section_text )) {
1912
1925
$ captureStdIn = stripos ($ section_text ['CAPTURE_STDIO ' ], 'STDIN ' ) !== false ;
1913
1926
$ captureStdOut = stripos ($ section_text ['CAPTURE_STDIO ' ], 'STDOUT ' ) !== false ;
1914
1927
$ captureStdErr = stripos ($ section_text ['CAPTURE_STDIO ' ], 'STDERR ' ) !== false ;
@@ -2213,7 +2226,7 @@ function run_test($php, $file, $env)
2213
2226
$ test_files [] = array ($ f , $ file );
2214
2227
}
2215
2228
}
2216
- $ test_cnt += @ count ($ test_files ) - 1 ;
2229
+ $ test_cnt += count ($ test_files ) - 1 ;
2217
2230
$ test_idx --;
2218
2231
2219
2232
show_redirect_start ($ IN_REDIRECT ['TESTS ' ], $ tested , $ tested_file );
@@ -2247,7 +2260,7 @@ function run_test($php, $file, $env)
2247
2260
}
2248
2261
}
2249
2262
2250
- if (is_array ($ org_file ) || @ count ( $ section_text [ 'REDIRECTTEST ' ]) == 1 ) {
2263
+ if (is_array ($ org_file ) || array_key_exists ( 'REDIRECTTEST ' , $ section_text ) ) {
2251
2264
2252
2265
if (is_array ($ org_file )) {
2253
2266
$ file = $ org_file [0 ];
0 commit comments