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

    • MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • master_MDL-46775
    • 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.

      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().

            simoncoggins Simon Coggins
            simoncoggins Simon Coggins
            Andrew Lyons Andrew Lyons
            Marina Glancy Marina Glancy
            Mark Nelson Mark Nelson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.