Moodle

'<' character needs to be escaped when displaying it in whole lesson view

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.4.1
  • Fix Version/s: 1.7.1
  • Component/s: Lesson
  • Labels:
    None
  • Environment:
    Windows XP
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_14_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE

Description

I have a short answer solution that should read:

i < total

When it is displayed, it just shows

i

The source of the page shows that the second part has been stripped, but the answer appears as it should when edited and used to check user answers.

Activity

Hide
Martin Dougiamas added a comment -

From Antti Boman (antti.boman at avence.fi) Tuesday, 28 September 2004, 03:44 PM:

This is not a duplicate of MDL-1625, but I wrote a small explanation of the problem there. This may be everywhere.

Show
Martin Dougiamas added a comment - From Antti Boman (antti.boman at avence.fi) Tuesday, 28 September 2004, 03:44 PM: This is not a duplicate of MDL-1625, but I wrote a small explanation of the problem there. This may be everywhere.
Hide
Mark Nielsen added a comment -

Hi Petr,

I added you as a watcher because I need some advise on this bug.

If one adds a Short Answer Question in the Lesson module and one of the answers is "i < total", then when the user answers the question, his/her answer gets cleaned to "i <total>".

The line of code that changes this is the following (line 91 in mod/lesson/action/continue.php):

$useranswer = stripslashes(clean_param($useranswer, PARAM_CLEAN));

I cannot find a different way to clean the users answer that does not change i < total to i <total>

I tried to find how this is accomplished with quiz and it appears that no cleaning is used (from what I can tell). Please advise on how this should be handled.

Much thanks!

Show
Mark Nielsen added a comment - Hi Petr, I added you as a watcher because I need some advise on this bug. If one adds a Short Answer Question in the Lesson module and one of the answers is "i < total", then when the user answers the question, his/her answer gets cleaned to "i <total>". The line of code that changes this is the following (line 91 in mod/lesson/action/continue.php): $useranswer = stripslashes(clean_param($useranswer, PARAM_CLEAN)); I cannot find a different way to clean the users answer that does not change i < total to i <total> I tried to find how this is accomplished with quiz and it appears that no cleaning is used (from what I can tell). Please advise on how this should be handled. Much thanks!
Hide
Petr Škoda (skodak) added a comment -

you can use PARAM_RAW in case when you expect non html text - but you have to make certain that you always use p() or s() when printing it

Show
Petr Škoda (skodak) added a comment - you can use PARAM_RAW in case when you expect non html text - but you have to make certain that you always use p() or s() when printing it
Hide
Mark Nielsen added a comment -

Thank you very much Petr!

Show
Mark Nielsen added a comment - Thank you very much Petr!
Hide
Mark Nielsen added a comment -

Fixed in 1.7+ and HEAD

Show
Mark Nielsen added a comment - Fixed in 1.7+ and HEAD

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: