?
avatar dtdpro
dtdpro
2 Nov 2017

Steps to reproduce the issue

  1. Create an article with "This is (Test) [Article]" as a title
  2. Search for "(Test" or "test)" or "[Art"

Expected result

Search contains title that links to the article

Actual result

Title is missing in matching search results

System information (as much as possible)

Joomla 3.8
PHP 7.0

Additional comments

This is similar to Issues #18432 and #18220 with Pull Requests #18433 and #18221

These are regular expression characters, other regular expressions characters may produce similar results.

Sugested Fix

Change on Line 161

$needle = str_replace('/', '\/', $needle);

to

$needle = preg_quote($needle,"/");

avatar dtdpro dtdpro - open - 2 Nov 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 2 Nov 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Nov 2017

Can't confirm.

Search for "(en" as Part of Title "Article (en-gb)" got:
bildschirmfoto 2017-11-02 um 14 52 36

Issue confirmed: Tried with given Example Article "This is (Test) [Article]" isn't found.

System information

3.8.2-dev
Multilanguage Site
macOS Sierra, 10.12.6
Firefox 56 (64-bit)

MAMP 4.1.1

  • PHP 7.0.15
  • MySQLi 5.6.35
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Nov 2017
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Nov 2017
Status Discussion Confirmed
avatar tonypartridge
tonypartridge - comment - 2 Nov 2017

This is usually down to the template since we added color highlighting a few version back the template may need updating.

Please test under protostar.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 3 Nov 2017

@tonypartridge Test used Protostar.

System information

3.8.2-dev
Multilanguage Site
macOS Sierra, 10.12.6
Firefox 56 (64-bit)

MAMP 4.1.1

  • PHP 7.0.15
  • MySQLi 5.6.35
avatar brianteeman
brianteeman - comment - 5 Nov 2017

I had no problem with (test) but i did have a problem with [test]


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18478.

avatar franz-wohlkoenig franz-wohlkoenig - change - 7 Nov 2017
Status Confirmed Discussion
avatar dtdpro
dtdpro - comment - 7 Nov 2017

@brianteeman Did you test with "(test)" or "(test", with both parenthesis the search results will appear as they should, but with only one the title will not appear.

Upon further investigation into the code for the search component and looking at the results with error reporting turned on, in /components/com_search/views/search/view.html.php $needle is not being properly escaped before being put into preg_replace (Line 271). This causes an error to occur when a regular expression character is used that would cause a bad expression, for instance when including just the left parenthesis:

Warning: preg_replace(): Compilation failed: missing ) at offset 10 in [WEBDIR]/components/com_search/views/search/view.html.php on line 270


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18478.

avatar dtdpro
dtdpro - comment - 7 Nov 2017

@brianteeman Did you test with "(test)" or "(test", with both parenthesis the search results will appear as they should, but with only one the title will not appear.

Upon further investigation into the code for the search component and looking at the results with error reporting turned on, in /components/com_search/views/search/view.html.php $needle is not being properly escaped before being put into preg_replace (Line 271). This causes an error to occur when a regular expression character is used that would cause a bad expression, for instance when including just the left parenthesis:

Warning: preg_replace(): Compilation failed: missing ) at offset 10 in [WEBDIR]/components/com_search/views/search/view.html.php on line 270


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18478.

avatar tonypartridge
tonypartridge - comment - 7 Nov 2017

I’ll take a deeper look

On 7 Nov 2017, 20:03 +0000, DtD Productions notifications@github.com, wrote:

@brianteeman Did you test with "(test)" or "(test", with both parenthesis the search results will appear as they should, but with only one the title will not appear.
Upon further investigation into the code for the search component and looking at the results with error reporting turned on, in /components/com_search/views/search/view.html.php $needle is not being properly escaped before being put into preg_replace (Line 271). This causes an error to occur when a regular expression character is used that would cause a bad expression, for instance when including just the left parenthesis:
Warning: preg_replace(): Compilation failed: missing ) at offset 10 in [WEBDIR]/components/com_search/views/search/view.html.php on line 270
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18478.

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

avatar brianteeman
brianteeman - comment - 7 Nov 2017

I tested with both @dtdpro

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 8 Nov 2017

closed as having Pull Request #18522

avatar joomla-cms-bot joomla-cms-bot - change - 8 Nov 2017
Closed_Date 2017-11-08 06:01:02 2017-11-08 06:01:03
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 8 Nov 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 8 Nov 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-11-08 06:01:02
Closed_By franz-wohlkoenig
avatar joomla-cms-bot
joomla-cms-bot - comment - 8 Nov 2017

Add a Comment

Login with GitHub to post a comment