$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);
$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...";
$text_truncated = "";
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
Labels |
Added:
?
|
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 $text_truncated = JHtmlString::testTruncateComplex($text, 220, true);
what happens if you use
$text_truncated = JHtmlString::testTruncateComplex($text, 220, true);
You can't use the methods from the PHPUnit test suite in the production code.
<i>Lorem ipsum dolor sit amet,</i>
and so on doesn't work.
<i>Lorem ipsum dolor<br>sit amet,</i>
works (BR between opening and closing I).
<em>Lorem ipsum dolor sit amet,</em>
works.
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, JHtml::_('string.truncateComplex', $text, 200);
but not with maximum 220, JHtml::_('string.truncateComplex', $text, 220);
Manipulating the text lenth or the maximum number gives different results. Some work fine, some don't.
Status | New | ⇒ | Confirmed |
Labels |
Added:
No Code Attached Yet
bug
Removed: ? |
Confirmed with 3.9.19-dev.
When I add a character before the starting
<b>
likez<b>
it works.