? ? Pending

User tests: Successful: Unsuccessful:

avatar Sophist-UK
Sophist-UK
6 Jan 2018

Issue occurred when Kunena had set a session variable of the form <strong>Some text</strong>.

json_encode was converting this to <strong>Some text<\/strong> - which was then an unclosed <strong> tag which was disrupting the remainder of the debug output.

Pull Request for Issue #19311 .

Summary of Changes

Added JSON_UNESCAPED_SLASHES to the json_encode so that closing HTML is not disrupted.

Escape any HTML in the JSON output by converting < and > to htmlentities.

Testing Instructions

  1. Create a session variable containing <strong>Some text</strong>.
  2. View session output before and after this fix.

Expected result

"<strong>Some text</strong>".

Documentation Changes Required

None

avatar Sophist-UK Sophist-UK - open - 6 Jan 2018
avatar Sophist-UK Sophist-UK - change - 6 Jan 2018
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Jan 2018
Category ⇒ Front End Plugins
avatar mbabker
mbabker - comment - 6 Jan 2018

This is going to introduce side effects breaking any other non-HTML uses of < and >.

avatar Sophist-UK
Sophist-UK - comment - 6 Jan 2018

This is going to introduce side effects breaking any other non-HTML uses of < and >.

The output of json_encode is a string and has no html inside, so this should not have any impact on changing genuine html to a literal output.

avatar mbabker
mbabker - comment - 6 Jan 2018

OK, and if you have a session var whose value is '1 < 2'?

avatar Sophist-UK Sophist-UK - change - 6 Jan 2018
Labels Added: ?
avatar Sophist-UK
Sophist-UK - comment - 6 Jan 2018

Then it sends html 1 &lt; 2 to the browser which is displayed as 1 < 2.

avatar Sophist-UK
Sophist-UK - comment - 6 Jan 2018

But suppose session string contains &amp;. We would want it displayed as &amp; and not &. So this changes it to &amp;amp; which is then displayed as &amp;.

avatar ReLater
ReLater - comment - 6 May 2018

With current 3.9-dev and patchtester I get an error "Error The patch could not be applied because the repository is missing"

avatar ReLater
ReLater - comment - 6 May 2018

PR seems to work. Tested like this:

  • In Isis index.php add lines
$session = JFactory::getSession();
$node = 'testtest';
$session->set($node, '<strong>Hello World!</strong> & Hello <span class="thang">Thing</span> &amp; Hello <span class="thing">Thang</span>! After.');
  • Activate debug mode in Global Configuration and save.
  • See Session panel

Before patch

071-05-_2018_00-41-38

After patch

072-05-_2018_00-49-36

avatar sanderpotjer
sanderpotjer - comment - 8 Sep 2018

I have tested this item ✅ successfully on cbd37aa

The PR branch is removed, so added the code myself to test.

Works as expected.


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

avatar sanderpotjer sanderpotjer - test_item - 8 Sep 2018 - Tested successfully
avatar yvesh
yvesh - comment - 8 Sep 2018

JSON_UNESCAPED_SLASHES requires PHP 5.4

avatar SharkyKZ SharkyKZ - test_item - 16 Oct 2019 - Tested successfully
avatar SharkyKZ
SharkyKZ - comment - 16 Oct 2019

I have tested this item ✅ successfully on cbd37aa

Patch applied manually.


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

avatar SharkyKZ SharkyKZ - change - 16 Oct 2019
Status Pending ⇒ Ready to Commit
avatar SharkyKZ
SharkyKZ - comment - 16 Oct 2019

RTC


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

avatar wilsonge wilsonge - change - 19 Oct 2019
Status Ready to Commit ⇒ Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 ⇒ 2019-10-19 21:55:49
Closed_By ⇒ wilsonge
Labels Added: ?
avatar wilsonge
wilsonge - comment - 19 Oct 2019

Thanks!

Add a Comment

Login with GitHub to post a comment