Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-15331

Feedback fails to remove slashes when editing questions in 1.9.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9, 1.9.1
    • Fix Version/s: 1.9.1
    • Component/s: Feedback
    • Labels:
      None
    • Environment:
      Feedback (2008050108), Moodle 1.9.1 (Build: 20080515), RHEL Linux 4, PHP 5.2.0, 5.0.27
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      When you edit a question in Feedback under Moodle 1.9, the backslashes used to escape quotes and apostrophes in the database are not being stripped out by the module. As a result, the slashes show up when you're editing the question, and are saved to the database when you save the question.

      To recreate the problem:

      1. Create a Feedback.
      2. Add a question with a quote or apostrophe in it.
      3. Save the question.
      4. Edit the question. The backslash should appear.
      5. Save the question. The backslash is saved to the database.

      The problem is that the 1.9 version of Moodle 1.9 is not using stripslashes_safe when it's loading the question text. The problem occurs with all of the question types and can be fixed by changing this line:

      $item->name = empty($item->name) ? '' : $item->name;

      to this:

      $item->name = empty($item->name) ? '' : stripslashes_safe($item->name);

      I've attached a patch that makes this change to the affected questions.

        Attachments

          Activity

            People

            • Assignee:
              grabs Andreas Grabs
              Reporter:
              lafayettenuke Kenneth Newquist
              Tester:
              Jérôme Mouneyrac
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/08