No Code Attached Yet bug
avatar mmsarki
mmsarki
4 May 2022

Steps to reproduce the issue

Add a unbreakable space   or   to the PLG_TASK_DEMO_TASKS_STRESS_MEMORY_DESC string value in administrator/languages/plg_task_demotasks.ini
Go to "system dashboard -> Scheduled Tasks -> Add your first Task, -> Select a Task type", the code for the unbreakable space is displayed

Expected result

unbreakable-space-ok

Actual result

unbreakable-space-displayed

System information (as much as possible)

Joomla! 4.1.2

Additional comments

file: administrator/components/com_scheduler/tmpl/select/default.php
in line 71

escape(strip_tags($item->desc)), 200); ?>
avatar mmsarki mmsarki - open - 4 May 2022
avatar joomla-cms-bot joomla-cms-bot - change - 4 May 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 May 2022
avatar mmsarki mmsarki - change - 4 May 2022
The description was changed
avatar mmsarki mmsarki - edited - 4 May 2022
avatar mmsarki mmsarki - change - 4 May 2022
The description was changed
avatar mmsarki mmsarki - edited - 4 May 2022
avatar mmsarki mmsarki - change - 4 May 2022
The description was changed
avatar mmsarki mmsarki - edited - 4 May 2022
avatar richard67 richard67 - change - 4 May 2022
The description was changed
avatar richard67 richard67 - edited - 4 May 2022
avatar richard67
richard67 - comment - 4 May 2022
avatar infograf768
infograf768 - comment - 5 May 2022

It would work in both cases if we take off the escape, i.e.

<?php $desc = HTMLHelper::_('string.truncate', strip_tags($item->desc), 200); ?>

Any reason for these strings to be escaped?

avatar brianteeman
brianteeman - comment - 5 May 2022

Any reason for these strings to be escaped?

Security?

avatar infograf768
infograf768 - comment - 5 May 2022

what about using this then

<?php $desc = HTMLHelper::_('string.truncate', html_entity_decode(strip_tags($item->desc), ENT_SUBSTITUTE, 'UTF-8'), 200); ?>

avatar sandewt
sandewt - comment - 7 May 2022

Add a unbreakable space &#160; or &nbsp; to the PLG_TASK_DEMO_TASKS_STRESS_MEMORY_DESC string value in administrator/languages/plg_task_demotasks.ini

Why would you do that? Useful?


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

avatar Quy
Quy - comment - 8 May 2022

The issue is that the & is escaped &amp; and not because it is a non-breaking space.

37740

This module displays a username and password login form. It also displays a link to retrieve a forgotten password. If user registration is enabled (in Users &amp;rarr; Manage &amp;rarr; Options),..
avatar infograf768
infograf768 - comment - 9 May 2022

Why would you do that? Useful?

In French some punctuation marks need to be preceded by non-breaking space to prevent that punctuation mark to jump alone into the next line, this whether in print or html.
Such as  ?  ;  :  ! « »

Note: I don't see the security reason forcing to escape in these descriptions. After all we are not escaping the extensions description and html entities work fine there.

avatar chmst chmst - change - 17 Feb 2023
Labels Added: bug
avatar chmst chmst - labeled - 17 Feb 2023
avatar brianteeman
brianteeman - comment - 11 Apr 2023

Looking at similar uses of string.truncate and/or displaying extension descriptions I dont see them using strip_tags or escape

if (!$long_description) {
$truncated = HTMLHelper::_('string.truncate', $short_description, 550, true, false);
if (strlen($truncated) > 500) {
$long_description = $short_description;
$short_description = HTMLHelper::_('string.truncate', $truncated, 250);
if ($short_description == $long_description) {
$long_description = '';
}

if (!$long_description) {
$truncated = HTMLHelper::_('string.truncate', $short_description, 550, true, false);
if (strlen($truncated) > 500) {
$long_description = $short_description;
$short_description = HTMLHelper::_('string.truncate', $truncated, 250);
if ($short_description == $long_description) {
$long_description = '';
}

It is only in administrator/components/com_modules/tmpl/select/default.php and its derivative administrator/components/com_scheduler/tmpl/select/default.php that we see this.

@joomla/security any objection to killing the escape and strip tatgs here

Add a Comment

Login with GitHub to post a comment