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

Call to function that hasn't been included when trying to load invalid JS file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.4, 2.7.1, 2.8
    • Fix Version/s: 2.6.5, 2.7.2
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide
      1. Install a test site
      2. Visit [siteurl]/lib/javascript.php/somestring and [siteurl]/theme/javascript.php/somestring
      3. Check that a "Slash argument must contain both a revision and a file path" error is displayed and the page returns a 404 error code.
      4. Visit [siteurl]/lib/javascript.php/-1/test.php
      5. Check that a "No valid javascript files found" error is displayed and the page returns a 404 error code.
      6. Check that normal javascript files are still loaded.
      Show
      Install a test site Visit [siteurl] /lib/javascript.php/somestring and [siteurl] /theme/javascript.php/somestring Check that a "Slash argument must contain both a revision and a file path" error is displayed and the page returns a 404 error code. Visit [siteurl] /lib/javascript.php/-1/test.php Check that a "No valid javascript files found" error is displayed and the page returns a 404 error code. Check that normal javascript files are still loaded.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      master_MDL-46775

      Description

      To reproduce

      1. Install a fresh instance of master
      2. Visit [siteurl]/lib/javascript.php/somerandomstring or [siteurl]theme/javascript.php/somerandomstring
      3. View the network panel of your browser's dev tools

      You will see the request returns a 500 error. If you comment out:

      define('NO_DEBUG_DISPLAY', true);

      in lib/javascript.php and/or theme/javascript.php

      You will get an error:

      Fatal error: Call to undefined function image_not_found() in /home/simonc/code/mdl22/lib/javascript.php on line 38

      This is because the function image_not_found() is not available from this file.

      I'm happy to provide a patch for this, but wanted to confirm the preferred approach. Personally I would replace image_not_found() with die(); since it is not an image anyway and die() is used later in that file.

      Alternatively I could create a new function js_not_found().

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Sep/14