diff --git a/_test/cases/inc/html_hilight.test.php b/_test/cases/inc/html_hilight.test.php index 1baec416aee7e5d5c6e5d1a776075898d3e6b9e6..944c90f1e683a2d479dbd27fd22fe185740b6362 100644 --- a/_test/cases/inc/html_hilight.test.php +++ b/_test/cases/inc/html_hilight.test.php @@ -62,8 +62,8 @@ class html_hilight_test extends UnitTestCase{ function testHighlightPHP() { $html = 'Foo $_GET[\'bar\'] Foo'; - $this->assertPattern( - '/Foo <span.*>'.preg_quote('$_GET[\'bar\']').'<\/span> Foo/', + $this->assertEqual( + 'Foo <span class="search_hit">$_GET</span>[\'<span class="search_hit">bar</span>\'] Foo', html_hilight($html,'$_GET[\'bar\']') ); } @@ -78,8 +78,8 @@ class html_hilight_test extends UnitTestCase{ function testMatchAttributeWord() { $html = 'Foo <b class="x">bar</b> Foo'; - $this->assertPattern( - '/Foo <b class="x">bar<\/b> Foo/', + $this->assertEqual( + 'Foo <b class="x"><span class="search_hit">bar</span></b> Foo', html_hilight($html,'class="x">bar') ); } diff --git a/inc/html.php b/inc/html.php index cdb8692df2a228bbce222b67cd3cb1c3bb92c391..41272b17f9d97e53a77415add59a2ae56f76091e 100644 --- a/inc/html.php +++ b/inc/html.php @@ -289,7 +289,7 @@ function html_show($txt=''){ */ function html_hilight($html,$query){ //split at common delimiters - $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>]+/',$query,-1,PREG_SPLIT_NO_EMPTY); + $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$query,-1,PREG_SPLIT_NO_EMPTY); foreach ($queries as $q){ $q = preg_quote($q,'/'); $html = preg_replace_callback("/((<[^>]*)|$q)/i",'html_hilight_callback',$html);