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

Custom menu with non valid URL generates unrecoverable exception

    XMLWordPrintable

Details

    • MOODLE_26_STABLE, MOODLE_28_STABLE
    • MOODLE_27_STABLE, MOODLE_28_STABLE
    • MDL-48430_master
    • Hide

      In function convert_text_to_menu_nodes on outputcomponents.php
      Do a try catch in the line:

      $itemurl = new moodle_url($setting);
      

      try {
         $itemurl = new moodle_url($setting);
      } catch (Exception $e){
         $itemurl = null
      }
      

      Show
      In function convert_text_to_menu_nodes on outputcomponents.php Do a try catch in the line: $itemurl = new moodle_url($setting); try { $itemurl = new moodle_url($setting); } catch (Exception $e){ $itemurl = null }
    • Easy
    • Hide

      -Edit custom_menu setting
      -Use the next text:

      MDL-48430|http:///moodle.org/
      

      -Save
      -Go to a page that shows the custom menu

      Show
      -Edit custom_menu setting -Use the next text: MDL-48430|http:///moodle.org/ -Save -Go to a page that shows the custom menu

    Description

      Using a wrong url in custom menu can generate an Exception that cannot be solved without editing database or config file.

      This is the traceback of 2.6

      Debug info: 
      Error code: invalidurl
      Stack trace:
      line 355 of /lib/weblib.php: moodle_exception thrown
      line 2808 of /lib/outputcomponents.php: call to moodle_url->__construct()
      line 2743 of /lib/outputcomponents.php: call to custom_menu::convert_text_to_menu_nodes()
      ....
      

      This is caused becase parse_url in the construction of moodle_url returns false.

      Attachments

        Activity

          People

            pferre22 Pau Ferrer
            pferre22 Pau Ferrer
            Simey Lameze Simey Lameze
            Sam Hemelryk Sam Hemelryk
            Rajesh Taneja Rajesh Taneja
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              12/Jan/15