php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #55736
Patch run-tests-expect_external revision 2011-09-20 09:22 UTC by tim at digicol dot de

Patch run-tests-expect_external for Testing related Bug #55736

Patch version 2011-09-20 09:22 UTC

Return to Bug #55736 | Download this patch
Patch Revisions:

Developer: tim@digicol.de

--- run-tests.php	2011-08-09 23:53:44.000000000 +0200
+++ run-tests.php.expect_external	2011-09-13 05:38:37.000000000 +0200
@@ -1286,18 +1286,20 @@
 				unset($section_text['FILEEOF']);
 			}
 
-			if (@count($section_text['FILE_EXTERNAL']) == 1) {
-				// don't allow tests to retrieve files from anywhere but this subdirectory
-				$section_text['FILE_EXTERNAL'] = dirname($file) . '/' . trim(str_replace('..', '', $section_text['FILE_EXTERNAL']));
-
-				if (file_exists($section_text['FILE_EXTERNAL'])) {
-					$section_text['FILE'] = file_get_contents($section_text['FILE_EXTERNAL'], FILE_BINARY);
-					unset($section_text['FILE_EXTERNAL']);
-				} else {
-					$bork_info = "could not load --FILE_EXTERNAL-- " . dirname($file) . '/' . trim($section_text['FILE_EXTERNAL']);
-					$borked = true;
-				}
-			}
+            foreach (array( 'FILE', 'EXPECT' ) as $key) {            
+                if (@count($section_text[$key . '_EXTERNAL']) == 1) {
+                    // don't allow tests to retrieve files from anywhere but this subdirectory
+                    $section_text[$key . '_EXTERNAL'] = dirname($file) . '/' . trim(str_replace('..', '', $section_text[$key . '_EXTERNAL']));
+    
+                    if (file_exists($section_text[$key . '_EXTERNAL'])) {
+                        $section_text[$key] = file_get_contents($section_text[$key . '_EXTERNAL'], FILE_BINARY);
+                        unset($section_text[$key . '_EXTERNAL']);
+                    } else {
+                        $bork_info = "could not load --" . $key . "_EXTERNAL-- " . dirname($file) . '/' . trim($section_text[$key . '_EXTERNAL']);
+                        $borked = true;
+                    }
+                }
+            }
 
 			if ((@count($section_text['EXPECT']) + @count($section_text['EXPECTF']) + @count($section_text['EXPECTREGEX'])) != 1) {
 				$bork_info = "missing section --EXPECT--, --EXPECTF-- or --EXPECTREGEX--";
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 09:01:36 2019 UTC