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

Backslashes in jQuery Plugin URL's

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.1, 2.9.1
    • Fix Version/s: 2.8.9, 2.9.3
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide

      PHPUnit

      1. Run PHPUnit tests for core_outputrequirementslib_testcase (lib/tests/outputrequirementslib_test.php)
        Confirm that there are no failures.

      Manual testing

      1. Install a Moodle instance running on IIS server. Make sure that the Moodle's root folder is also the document root of the server. To do this:
        1. Launch the IIS Manager application.
        2. Under the Connections panel, select "Default Web Site".
        3. On the Actions panel, and click "Advanced Settings..".
        4. On the Advanced Settings window, set the Physical Path setting to the path of the moodle root folder then click OK.
      2. Using Firefox, go to Site administration ▶︎ Server ▶︎ HTTP. Make sure that "Use slash arguments" is unchecked.
      3. Go to lib/tests/other/jquerypage.php.
        Confirm that the page is properly loaded and that you can see the various jQuery UI widgets on the page.

      Optional

      1. Perform the above tests on other browsers and web servers (i.e. Apache, etc).
      Show
      PHPUnit Run PHPUnit tests for core_outputrequirementslib_testcase (lib/tests/outputrequirementslib_test.php) Confirm that there are no failures. Manual testing Install a Moodle instance running on IIS server. Make sure that the Moodle's root folder is also the document root of the server. To do this: Launch the IIS Manager application. Under the Connections panel, select "Default Web Site". On the Actions panel, and click "Advanced Settings..". On the Advanced Settings window, set the Physical Path setting to the path of the moodle root folder then click OK. Using Firefox, go to Site administration ▶︎ Server ▶︎ HTTP. Make sure that "Use slash arguments" is unchecked. Go to lib/tests/other/jquerypage.php. Confirm that the page is properly loaded and that you can see the various jQuery UI widgets on the page. Optional Perform the above tests on other browsers and web servers (i.e. Apache, etc).
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull Master Branch:
      MDL-47073-master

      Description

      When run on a Windows server, or more specifically IIS in my case, the URL's for jQuery plugins in a theme will output with backslashes instead of forward. This causes issues in Firefox as they don't deal with backslashes in URL's.

      https://bugzilla.mozilla.org/show_bug.cgi?id=backslash

      To get straight to the point, in /lib/outputrequirementslib.php jquery_plugin() derives the $url from the $path, which is the full path on the hard drive and contains OS specific directory separators.

      https://github.com/moodle/moodle/blob/v2.9.2/lib/outputrequirementslib.php#L550

      There is probably a more "correct" way to fix this issue, but for now I've inserted a simple str_replace() (below the line highlighted above) to convert backslashes to forward slashes. I'll also look at enabling the `slasharguments` option mentioned in the code comments.

      $url = str_replace('\\', '/', $url); 
      

        Attachments

          Activity

            People

            Assignee:
            jpataleta Jun Pataleta
            Reporter:
            ryan.isd196 Ryan Panning
            Peer reviewer:
            Adrian Greeve
            Integrator:
            Andrew Nicols
            Tester:
            Rajesh Taneja
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              9/Nov/15