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

get_query_string() cannot handle nested array keys in moodle urls

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.1.17, 4.5.3
    • General
    • MOODLE_401_STABLE, MOODLE_405_STABLE

      When get_query_string() is used on a moodle url that contains params with nested array keys the following occurs:

      Exception - rawurlencode(): Argument #1 ($string) must be of type string, array given

      It can be replicated with a single line: 

       

      (new \moodle_url('/?param[0][0]=0'))->get_query_string(); 

      In practice the use case for this is pretty small and I haven't hit it in core. We hit this when using it to analyse the current url in a plugin, and this formatting can be seen in a few places like webservice urls - /webservice/rest/server.php?wstoken=x&wsfunction=core_user_get_users&criteria[0][key]=username&criteria[0][value]=name

      We have since changed our approach, but thought this was still worth reporting.

       

            Unassigned Unassigned
            benjaminwalker Benjamin Walker
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

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