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

Type error in LTI 1.3 content selection when empty object passed in JSON

    • MOODLE_401_STABLE
    • Hide

      Testing steps

      1. Set up a Moodle-to-Moodle LTI using LTI Advantage (See the first few sections of MDL-78219's testing instructions if you're not sure how this is done. Also, docs if needed). You'll need one published activity - published over LTI 1.3.
      2. Apply this patch to the TOOL site: https://github.com/snake/moodle/compare/580c009cacb...MDL-77249-replication-deeplinkresponse. This just forced an empty object within the deep link response JSON.

        git pull https://github.com/snake/moodle MDL-77249-replication-deeplinkresponse
        

      3. In the PLATFORM site, click to create an activity
      4. Select the Moodle tool
      5. Select the activity checkbox and click "Add content"
      6. Verify the modal closes without error, and you see the activity instance form is updated with details of the activity (e.g. name)
      Show
      Testing steps Set up a Moodle-to-Moodle LTI using LTI Advantage (See the first few sections of MDL-78219 's testing instructions if you're not sure how this is done. Also, docs if needed). You'll need one published activity - published over LTI 1.3. Apply this patch to the TOOL site: https://github.com/snake/moodle/compare/580c009cacb...MDL-77249-replication-deeplinkresponse . This just forced an empty object within the deep link response JSON. git pull https://github.com/snake/moodle MDL-77249-replication-deeplinkresponse In the PLATFORM site, click to create an activity Select the Moodle tool Select the activity checkbox and click "Add content" Verify the modal closes without error, and you see the activity instance form is updated with details of the activity (e.g. name)

      I have an LTI 1.3 tool registered using deep linking/content selection. When I add a new activity using the tool, then Select Content, then select from the tool, I get an error from Moodle:

      Exception - Argument 1 passed to params_to_string() must be an object, array given, called in [dirroot]/mod/lti/locallib.php on line 1576

      The Apache log says:

      PHP message: Default exception handler: Exception - Argument 1 passed to params_to_string() must be an object, array given, called in [dirroot]/mod/lti/locallib.php on line 1576 Debug: 
      Error code: generalexceptionmessage

      • line 1464 of /mod/lti/locallib.php: TypeError thrown
      • line 1576 of /mod/lti/locallib.php: call to params_to_string()
      • line 1629 of /mod/lti/locallib.php: call to content_item_to_form()
      • line 84 of /mod/lti/contentitem_return.php: call to lti_tool_configuration_from_content_item()
        ', referer: https://[redacted]/

      This did not happen in 4.0, only since switching to v4.1.1.

      To reproduce:

      1. Set up a Moodle-to-Moodle LTI using LTI Advantage (See the first few sections of MDL-78219's testing instructions if you're not sure how this is done. Also, docs if needed). You'll need one published activity - published over LTI 1.3.
      2. Apply this patch to the TOOL site: https://github.com/snake/moodle/compare/580c009cacb...MDL-77249-replication-deeplinkresponse. This just forced an empty object within the deep link response JSON.

        git pull https://github.com/snake/moodle MDL-77249-replication-deeplinkresponse
        

      3. In the PLATFORM site, click to create an activity
      4. Select the Moodle tool
      5. Select the activity checkbox and click "Add content"
        Expected: The modal closes without error, and you see the activity instance form is updated with details of the activity (e.g. name)
        Actual: You'll see an exception in the modal:

        Exception - params_to_string(): Argument #1 ($params) must be of type object, array given, called in [dirroot]/mod/lti/locallib.php on line 1503
        

            mpetrowi Matt Petro
            hmoffatt Hamish Moffatt
            Jake Dallimore Jake Dallimore
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 minutes
                5m

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