?
avatar keewhip
keewhip
12 Aug 2020

Steps to reproduce the issue

Publish article with 400 characters

This product is meant for educational purposes only. Any resemblance to real persons, living or dead is purely coincidental. Void where prohibited. Some assembly required. List each check separately by bank number. Batteries not included.
The 'Ledger'
Contents may settle during shipment. Use only as directed. No other warranty expressed or implied. Do not use while operating a motor vehicle or heavy equipment. Postage will be paid by addressee. Subject to CARB approval.

Use the standard joomla search component to search for shipment

Expected result

Search text results returns

... bank number. Batteries not included. 
The 'Ledger' 
Contents may settle during <span class="highlight">shipment</span>. Use only as directed. No other warranty expressed or implied. Do not use while operating a motor vehicle or heavy&#160;...

Actual result

Search text results returns text without the last character heavy => heav

...&#160;bank number. Batteries not included. 
The 'Ledger' 
Contents may settle during <span class="highlight">shipment</span>. Use only as directed. No other warranty expressed or implied. Do not use while operating a motor vehicle or heav&#160;...

System information (as much as possible)

Joomla 3.9.20

Additional comments

The function remove_accents in administrator\components\com_search\helpers\search.php can change the length of the string which is used for searching.
By changing The 'Ledger' to The Ledger', the string is shortened by 1 character (preg_replace("/[\"'^]([a-z])/ui", '\1', $str);)
The start position and length from the match in the modified string are used to return a portion of the original string, thus producing breaks in the middle of words.

The same thing can happen with the transliteration of the string in the remove_accents function.
By replacing ü => ue, ä => ae, æ => ae, et cetera the modified string is lengthened

Solution

Check if the modified string is lengthened or shortened and use this for the calculation of starting position and length of the original string.

avatar keewhip keewhip - open - 12 Aug 2020
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Aug 2020
avatar Quy Quy - change - 12 Aug 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-08-12 20:20:14
Closed_By Quy
avatar Quy Quy - close - 12 Aug 2020
avatar Quy
Quy - comment - 12 Aug 2020

Closing per PR #30350

Add a Comment

Login with GitHub to post a comment