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