-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JHtmlString::truncateComplex not working with some strings #28822
Comments
Confirmed with 3.9.19-dev. When I add a character before the starting |
it also works with additional chars at the end or when changing order of words (spaces) at the end - I tried to find and fix the bug, but its not so easy - the bug occurs only under certain circumstances. |
what happens if you use |
You can't use the methods from the PHPUnit test suite in the production code. |
Looks like it has something to do with the 1-character tags. |
The same with JHtml::_('string.truncateComplex', $text, 220); It works with maximum 200 or smaller numbers, Manipulating the text lenth or the maximum number gives different results. Some work fine, some don't. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28822. |
Steps to reproduce the issue
$text = "<b>Lorem ipsum dolor sit amet,</b><br>consectetur adipisicing elit. Animi aspernatur aut deserunt dolorum excepturi, laudantium maxime minus molestiae nihil nobis numquam, quam quasi voluptatibus. Accusamus ipsum nullase isquam eos.";
$text_truncated = JHtmlString::truncateComplex($text, 220, true);
Expected result
$text_truncated = "<b>Lorem ipsum dolor sit amet,</b><br>consectetur adipisicing elit. Animi aspernatur aut deserunt dolorum excepturi, laudantium maxime minus molestiae nihil nobis numquam, quam quasi voluptatibus. Accusamus ipsum nullase isquam...";
Actual result
$text_truncated = "";
System information (as much as possible)
PHP erstellt für | Windows NT SBA-AHW2019 10.0 build 18363 (Windows 10) AMD64
Datenbanktyp | mysql
Datenbankversion | 5.5.5-10.3.10-MariaDB
Datenbankzeichensatz | latin1_swedish_ci
Datenbankverbindungszeichensatz | utf8mb4_general_ci
PHP-Version | 7.3.6
Webserver | Apache/2.4.39 (Win64) OpenSSL/1.1.1c PHP/7.3.6
PHP-Interface für den Webserver | apache2handler
Joomla!-Version | Joomla! 3.9.18 Stable [ Amani ] 21-April-2020 19:30 GMT
Joomla!-Plattform-Version | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
Browsererkennung | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
Additional comments
The text was updated successfully, but these errors were encountered: