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

Shorten text can cause invalid HTML

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3.2, 2.4.3, 2.5
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Libraries
    • Labels:

      Description

      Add this unit test to lib/tests/moodlelib_test.php.

          function test_shorten_text_multilang() {
              $text = '<span lang="en" class="multilang">A</span>' .
                      '<span lang="fr" class="multilang">B</span>';
              $this->assertEquals('<span lang="en" class="multilang">A</span>...', shorten_text($text, 1));
          }
      

      The actual result, right now, is '<span lang="en" ...</span>', so the test fails. Clearly, shorten_text should never return invalid HTML, so this test should pass.

        Attachments

          Activity

            People

            Assignee:
            timhunt Tim Hunt
            Reporter:
            timhunt Tim Hunt
            Peer reviewer:
            Dan Poltawski
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Eloy Lafuente (stronk7)
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/May/13