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

navmenu() trashes $modinfo

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9.1
    • Component/s: Libraries
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      The navmenu() function makes a change to the $modinfo variable obtained by get_fast_modinfo. The $cms[id] entry for the current module has its name overwritten to 'Jump to...'.

      These changes are intended to be local to the function, however it is actually working on a reference to the cached modinfo which means that anyone who calls get_fast_modinfo later gets the messed-up data!

      I don't know if this has any code effect in moodle 1.9 but as it is a bugfix maybe is worth doing. Should definitely go into head.

      I have attached the patch - simplest/most efficient fix was simply to save the previous value and restore it afterwards (rather than trying to clone the variable or anything).

        Attachments

        1. navmenu.patch
          1 kB
          Sam Marshall
        2. navmenu2.patch
          2 kB
          Sam Marshall
        3. navmenu3.patch
          2 kB
          Sam Marshall

          Activity

            People

            Assignee:
            quen Sam Marshall
            Reporter:
            quen Sam Marshall
            Tester:
            Eloy Lafuente (stronk7)
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

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