summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_test/bootstrap.php4
-rw-r--r--inc/search.php2
2 files changed, 5 insertions, 1 deletions
diff --git a/_test/bootstrap.php b/_test/bootstrap.php
index 58ad6a0d7..310b3627a 100644
--- a/_test/bootstrap.php
+++ b/_test/bootstrap.php
@@ -110,3 +110,7 @@ $dh->close();
// load dw
require_once(DOKU_INC.'inc/init.php');
+// load the parser so $PARSER_MODES is defined before the tests start
+// otherwise PHPUnit unsets $PARSER_MODES in some cases which breaks p_get_parsermodes()
+require_once(DOKU_INC.'inc/parser/parser.php');
+
diff --git a/inc/search.php b/inc/search.php
index a02b86b34..1cecfd5ec 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -119,7 +119,7 @@ function search_index(&$data,$base,$file,$type,$lvl,$opts){
'listfiles' => !$opts['nofiles'],
'sneakyacl' => $conf['sneaky_index'],
// Hacky, should rather use recmatch
- 'depth' => preg_match('#^'.$file.'(/|$)#','/'.$opts['ns']) ? 0 : -1
+ 'depth' => preg_match('#^'.preg_quote($file, '#').'(/|$)#','/'.$opts['ns']) ? 0 : -1
);
return search_universal($data, $base, $file, $type, $lvl, $opts);