? ? Success

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
27 Jun 2017

Pull Request for Issue ##16812

I'm not sure if this is correct. This is my initial concept.

Summary of Changes

  1. New way for getString() method:
    getString() - always remove all tags

Above idea is borrowed from #16842

  1. New way for getHtml() method:
    getHtml() - escapes < and > instead remove it:
  • if character < is followed by a white space, ex 4 < 5 then it will be replaced by 4 &lt; 5
  • if > does not have paired <, ex: A>B => A&gt;B
  • if <> then that characters will be replace by &lt;&gt; ???
  • if < does not have a pair with > then it will be replaced by &lt;, ex: A<B => A&lt;B
  1. Fix notice:
    Notice: A non well formed numeric value encountered in .../libraries/joomla/filter/input.php on line 1202 divHello "Joomla"

tested as:

$_REQUEST['test'] = '<div&#x003e;Hello &quot;Joomla&quot;&#60;/div>';
echo JFactory::getApplication()->input->getString('test', '');die;

Testing Instructions

Not yet.
I suspect that above point 2 could not be accepted in full. Any comments?

Expected result

getString() will always return clean text without any tags. Input whitelist and blacklist will not change that.

Actual result

...

Documentation Changes Required

Probably.

Details

  1. For filter instance with default blacklist enabled:
No. Input Type Old behaviour* This PR
1. '<em' 'STRING' 'em' ''
'<em' '' 'em' '&lt;em'
'<em' 'HTML' 'em' '&lt;em'
'&lt;em' 'STRING' 'em' ''
'&lt;em' '' 'em' '&lt;em'
'&lt;em' 'HTML' '&lt;em' '&lt;em'
2. 'em>' 'STRING' 'em>' 'em>'
'em>' '' 'em>' 'em&gt;'
'em>' 'HTML' 'em>' 'em&gt;'
'em&gt;' 'STRING' 'em>' 'em>'
'em&gt;' '' 'em>' 'em&gt;'
'em&gt;' 'HTML' 'em&gt;' 'em&gt;'
3. '< ' 'STRING' ' ' '< '
'< ' '' ' ' '&lt; '
'< ' 'HTML' ' ' '&lt; '
'&lt; ' 'STRING' ' ' '< '
'&lt; ' '' ' ' '&lt; '
'&lt; ' 'HTML' '&lt; ' '&lt; '
4.** '<>' 'STRING' '' ''
'<>' '' '' '&lt;&gt;'
'<>' 'HTML' '' '&lt;&gt;'
'&lt;&gt;' 'STRING' '' ''
'&lt;&gt;' '' '' '&lt;&gt;'
'&lt;&gt;' 'HTML' '&lt;&gt;' '&lt;&gt;'

(*) Old behaviour means behaviour on J3.7.2 and older.
(**) I'm going to revert behaviour for point 4 on this PR.

avatar csthomas csthomas - open - 27 Jun 2017
avatar csthomas csthomas - change - 27 Jun 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Jun 2017
Category Libraries Unit Tests
avatar csthomas csthomas - change - 27 Jun 2017
The description was changed
avatar csthomas csthomas - edited - 27 Jun 2017
avatar joeforjoomla
joeforjoomla - comment - 27 Jun 2017

Sounds good to me.
Just tested the getString method and it works as expected. Now it's possible to preserve '<' and '>' characters if used in a generic context.

avatar rdeutz rdeutz - assigned - 27 Jun 17
avatar csthomas csthomas - change - 27 Jun 2017
The description was changed
avatar csthomas csthomas - edited - 27 Jun 2017
avatar csthomas csthomas - change - 28 Jun 2017
The description was changed
avatar csthomas csthomas - edited - 28 Jun 2017
avatar rdeutz
rdeutz - comment - 28 Jun 2017

I am not going to merge this. After some discussion I came to the conclusion that we need to look deeper into this and that we don't have the time to do this before the next release will be out.

avatar csthomas
csthomas - comment - 28 Jun 2017

OK. If this can help I can remove all changes from point 2, means all changes for getHtml().
This way it will be more similar to #16842

avatar joeforjoomla
joeforjoomla - comment - 28 Jun 2017

@rdeutz If this issue #16842 is going to be introduced in the next 3.7.3 update it should be at least documented as potential issues can arise. For example our extensions need an update because the '>' character is stripped out by getString.
If we don't have time to get it definitely fixed for 3.7.3, at least it would be the case to revert the getString method to still allow the '>' character as in 3.7.2 to avoid bugs.

avatar csthomas
csthomas - comment - 28 Jun 2017

I wrote small PR to fix only B/C break in input filter. It is not complicated as this one.

avatar csthomas csthomas - close - 4 Nov 2017
avatar csthomas csthomas - change - 4 Nov 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-11-04 12:25:43
Closed_By csthomas

Add a Comment

Login with GitHub to post a comment