File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ public function test_ajax_default()
205205 'autocomplete ' => [
206206 'mininput ' => 2 ,
207207 'maxresult ' => 5 ,
208- 'namespace ' => '' ,
208+ 'filter ' => '' ,
209209 'postfix ' => '' ,
210210 ],
211211 ]
@@ -238,6 +238,10 @@ public function test_ajax_default()
238238 ], $ page ->handleAjax ());
239239 }
240240
241+ /**
242+ * Test deprecated option namespace
243+ * @return void
244+ */
241245 public function test_ajax_namespace ()
242246 {
243247 global $ INPUT ;
@@ -257,7 +261,7 @@ public function test_ajax_namespace()
257261 $ this ->assertEquals ([['label ' => 'syntax (wiki) ' , 'value ' => 'wiki:syntax ' ]], $ page ->handleAjax ());
258262 }
259263
260- public function test_ajax_namespace_multiple ()
264+ public function test_ajax_filter_multiple ()
261265 {
262266 global $ INPUT ;
263267
@@ -266,7 +270,7 @@ public function test_ajax_namespace_multiple()
266270 'autocomplete ' => [
267271 'mininput ' => 2 ,
268272 'maxresult ' => 5 ,
269- 'namespace ' => '(wiki|foo) ' ,
273+ 'filter ' => '(wiki|foo) ' ,
270274 'postfix ' => '' ,
271275 ],
272276 ]
@@ -279,6 +283,10 @@ public function test_ajax_namespace_multiple()
279283 ], $ page ->handleAjax ());
280284 }
281285
286+ /**
287+ * Test deprecated option postfix
288+ * @return void
289+ */
282290 public function test_ajax_postfix ()
283291 {
284292 global $ INPUT ;
Original file line number Diff line number Diff line change 55use dokuwiki \File \PageResolver ;
66use dokuwiki \plugin \struct \meta \QueryBuilder ;
77use dokuwiki \plugin \struct \meta \QueryBuilderWhere ;
8+ use dokuwiki \plugin \struct \meta \StructException ;
89use dokuwiki \Utf8 \PhpString ;
910
1011/**
@@ -256,7 +257,12 @@ public function filterMatch($id, $filter)
256257 $ filter = '^ ' . $ filter ;
257258 }
258259
259- return (bool )preg_match ('/ ' . $ filter . '/ ' , ': ' . $ id , $ matches );
260+ try {
261+ $ check = preg_match ('/ ' . $ filter . '/ ' , ': ' . $ id , $ matches );
262+ } catch (\Exception $ e ) {
263+ throw new StructException ("Error processing regular expression ' $ filter' " );
264+ }
265+ return (bool )$ check ;
260266 }
261267
262268 /**
You can’t perform that action at this time.
0 commit comments