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

requirejs.php matches module name even if module has a name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 4.0.9, 4.1.4, 4.2.1
    • 4.0.8, 4.1.3, 4.2.1
    • JavaScript
    • MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-78157-401
    • MDL-78157-402
    • MDL-78157-master
    • Hide
      1. Open a terminal and go to your moodle installation's root folder.
      2. Download 0001-MDL-78157-amd-FOR-TESTING.patch to your Moodle root folder.
      3. Apply it.

        git am ./0001-MDL-78157-amd-FOR-TESTING.patch
        

      4. Purge caches. (e.g. with MDK, "mdk purge")
      5. Hop over to Moodle in your browser
      6. Open the console
      7. Run:

        require(['core/codemirror'], console.log);
        

        1. Confirm you were shown an object containing:
          1. EditorState
          2. EditorView
          3. lang
          4. basicSetup

      After the test: Make sure to revert the changes from the test patch. ("git reset --hard origin/[BRANCH_YOU'RE_TESTING]")

      Show
      Open a terminal and go to your moodle installation's root folder. Download 0001-MDL-78157-amd-FOR-TESTING.patch to your Moodle root folder. Apply it. git am ./0001-MDL-78157-amd-FOR-TESTING.patch Purge caches. (e.g. with MDK, " mdk purge ") Hop over to Moodle in your browser Open the console Run: require(['core/codemirror'], console.log); Confirm you were shown an object containing: EditorState EditorView lang basicSetup After the test: Make sure to revert the changes from the test patch. (" git reset --hard origin/ [BRANCH_YOU'RE_TESTING] ")

      The cruddy preg_match at the bottom of lib/requirejs.php matches:

      preg_match('/define\(\s*(\[|function)/', $js)
      

      However, it's perfectly possible for a module to:

      • have a correct and valid define ("core/foo", ... line; and to
      • have another, totally unrelated, {{static define(config = {}) }} line or similar

      We need to make this suck less.

        1. 0001-MDL-78157-amd-FOR-TESTING.patch
          2.18 MB
        2. codemirror.js
          1.10 MB
        3. image-2023-05-29-17-01-05-328.png
          image-2023-05-29-17-01-05-328.png
          94 kB
        4. MDL-78157.png
          MDL-78157.png
          157 kB

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Jordi Pujol-Ahulló Jordi Pujol-Ahulló
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 39 minutes
                2h 39m

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