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

Suspect coding error in lib/filelib.php, breaks images in HTML block

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide
      1. On front page, add HTML block with an image.
      2. Set the block to be display throughout the entire site
      3. Go to a course
      4. Move the position of the HTML block to different area (eg: from right to left)
      5. Go to Front page, and move the postion to different area.
      6. Refresh the page
      7. Copy the image url from the block and paste it to a new window

      Make sure there's no error occurs for the page.

      Show
      On front page, add HTML block with an image. Set the block to be display throughout the entire site Go to a course Move the position of the HTML block to different area (eg: from right to left) Go to Front page, and move the postion to different area. Refresh the page Copy the image url from the block and paste it to a new window Make sure there's no error occurs for the page.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      At around line 4280 (version 2.4.1), there is this database call..

      $bprecord = $DB->get_record('block_positions', array('blockinstanceid' => $context->instanceid), 'visible');

      The '$fields' parameter is just 'visible'. This is wrong as, AFAIK, there always needs to be a unique field first (usually 'id'). Whenever this line runs it will throw an error...

      Did you remember to make the first column something unique in your call to get_records? Duplicate value '1' found in column 'visible'.

      line 1032 of /lib/dml/mysqli_native_moodle_database.php: call to debugging()
      line 1382 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
      line 1354 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1333 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 4280 of /lib/filelib.php: call to moodle_database->get_record()
      line 38 of /pluginfile.php: call to file_pluginfile()

      I am not sure under exactly what circumstances it is called. I have not been able to recreate the problem myself but some of my clients see it. It is related to adding an image to an HTML block.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13