Moodle

Spaces and special chars gobbled in RSS feeds custom title

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6.5, 1.7.3, 1.8.3, 1.9
  • Fix Version/s: 1.9, 2.0
  • Component/s: RSS
  • Labels:
    None
  • Environment:
    All
  • Affected Branches:
    MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

When specifying spaces or chars with diacritics in custom title of an RSS feed, these chars are gobbled, i.e. are discarded by Moodle.

Issue Links

Activity

Hide
Peter Cliff added a comment -

This can be traced to the line:

$preferredtitle = optional_param('preferredtitle', '', PARAM_ALPHA);

in MOODLEROOT/blocks/rss_client/block_rss_client_action.php

The PARAM_ALPHA is stripping out all those spaces and diacritics:

case PARAM_ALPHA: // Remove everything not a-z
367 return eregi_replace('[^a-zA-Z]', '', $param);

So, I guess the block code needs changing to use PARAM_CLEANHTML or PARAM_TEXT?

Show
Peter Cliff added a comment - This can be traced to the line: $preferredtitle = optional_param('preferredtitle', '', PARAM_ALPHA); in MOODLEROOT/blocks/rss_client/block_rss_client_action.php The PARAM_ALPHA is stripping out all those spaces and diacritics: case PARAM_ALPHA: // Remove everything not a-z 367 return eregi_replace('[^a-zA-Z]', '', $param); So, I guess the block code needs changing to use PARAM_CLEANHTML or PARAM_TEXT?
Hide
Nicolas Martignoni added a comment -

Does anybody work on this (not working as of 1.8b fresh from CVS)?

Show
Nicolas Martignoni added a comment - Does anybody work on this (not working as of 1.8b fresh from CVS)?
Hide
Brett Hinton added a comment -

I replaced PARAM_ALPHA with PARAM_CLEANHTML and my RSS feeds can now have custom titles. I have tested this and have not noticed any side effects. I not familiar with Moodle's API so I don't if PARAM_TEXT would be a better option. I couldn't track down the code to see what gets stripped when PARAM_CLEANHTML gets passed versus PARAM_TEXT, but with PARAM_CLEANHTML at least the Custom title can have spaces.

Show
Brett Hinton added a comment - I replaced PARAM_ALPHA with PARAM_CLEANHTML and my RSS feeds can now have custom titles. I have tested this and have not noticed any side effects. I not familiar with Moodle's API so I don't if PARAM_TEXT would be a better option. I couldn't track down the code to see what gets stripped when PARAM_CLEANHTML gets passed versus PARAM_TEXT, but with PARAM_CLEANHTML at least the Custom title can have spaces.
Hide
Nicolas Martignoni added a comment -

If this solution is OK, I would suggest to patch this in 1.8.1.

Show
Nicolas Martignoni added a comment - If this solution is OK, I would suggest to patch this in 1.8.1.
Hide
Nicolas Martignoni added a comment -

Bump. Still present as of 1.9beta3.

Show
Nicolas Martignoni added a comment - Bump. Still present as of 1.9beta3.
Hide
Dan Poltawski added a comment -

Hi, thanks for the report!
This is fixed in CVS

Show
Dan Poltawski added a comment - Hi, thanks for the report! This is fixed in CVS
Hide
Nicolas Martignoni added a comment -

Verified on 1.9beta3 fresh from CVS. Closing. Thanks Dan!

Show
Nicolas Martignoni added a comment - Verified on 1.9beta3 fresh from CVS. Closing. Thanks Dan!

People

Vote (4)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: