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

Infinite loop in multilang filter

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.5, 3.7.1
    • Fix Version/s: None
    • Component/s: Filters, Language
    • Labels:
      None
    • Testing Instructions:
      Hide

      Ensure that the language packs fr and fr_ca are installed on the site.
      Set langlist to "en,fr_ca".
      Enable the multilang filter.
      Navigate to any page containing multilang content, but missing strings for fr_ca.
      Switch preferred user language to fr_ca.
      Confirm the page loads.

      Show
      Ensure that the language packs fr and fr_ca are installed on the site. Set langlist to "en,fr_ca". Enable the multilang filter. Navigate to any page containing multilang content, but missing strings for fr_ca. Switch preferred user language to fr_ca. Confirm the page loads.
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE

      Description

      Multilang filter is causing infinite loops when the parent of a language pack is not listed in the "langlist" setting.

      The loop is triggered by MDL-55197 calling get_parent_lang().
      http://git.moodle.org/gw?p=moodle.git;a=blob;f=filter/multilang/filter.php;h=2e9bac35575eef0fb4befea4b5eb7ce98e9c2c92;hb=0925ecdbd4b4ed6d82eab91364d870835bd1a418#l105

      When trying to switch the user language to "fr_ca", the site will end up in an infinite loop if "fr", the parent of "fr_ca" is not listed in langlist.

      As a workaround, adding "fr" to langlist makes the site behave normally.

      The bug is caused by moodlelib.php function get_parent_language() trying to hack around the current language, but failing to switch to "fr" since "fr" is not in langlist.
      http://git.moodle.org/gw?p=moodle.git;a=blob;f=lib/moodlelib.php;h=e2016a8bf75824ef84096ee27e3c573498eb38b5;hb=refs/heads/MOODLE_36_STABLE#l7018

      We have found the solution proposed in MDL-66197 to fix this bug, so perhaps it should be applied from version 3.6 upwards.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                schach Heiko Schach
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, cameron1729, David Mudrák (@mudrd8mz), Helen Foster
              • Votes:
                3 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: