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

badges: strtoupper garbles double-byte chars

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.6, 2.6.3, 2.7, 2.8, 2.9
    • Fix Version/s: 2.7.4, 2.8.2
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      Testing:

      • Install the Japanese lang pack (Site admin -> Language -> Language packs) and switch to Japanese language;
      • Add a new badge and add a criterion to the badge that allow it to be issued manually by any or all roles (Admin, Teacher, non-editing teacher);
      • Go to badge Overview tab;
      • Make sure the Japanese word for "ANY" (or "ALL" depending on your criteria settings) is not getting garbled in the section that displays the criteria (see attached images of before/after).
      Show
      Testing: Install the Japanese lang pack (Site admin -> Language -> Language packs) and switch to Japanese language; Add a new badge and add a criterion to the badge that allow it to be issued manually by any or all roles (Admin, Teacher, non-editing teacher); Go to badge Overview tab; Make sure the Japanese word for "ANY" (or "ALL" depending on your criteria settings) is not getting garbled in the section that displays the criteria (see attached images of before/after).
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull Master Branch:
      MDL-48115_master

      Description

      The following scripts use plain "strtoupper", which garbles double byte unicode chars (e.g. Japanese).

      • badges/criteria/award_criteria.php
      • badges/criteria/award_criteria_overall.php
      • badges/renderer.php

      The fix is to use Moodle's text handling libraries:

      • Moodle >= 2.6 replace "strtoupper" with "core_text::strtoupper"
      • Moodle == 2.5 replace "strtoupper" with "textlib::strtoupper"
      • Moodle <= 2.4 no fix required - badges didn't exist then

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/Jan/15