Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      5464

      Description

      For the majority of cases this is not a problem, since we expect URLs to be properly decoded before being sent to the browser. However, anything involving a redirect through PHP header() or JS window.location | window.open fails to interpret a long URL with query params properly.

      required_param() and optional_param() use $_GET as a direct lookup, but this global variable fails to find params that are separated by &

      The new moodle_url() constructor, however, correctly interprets this type of URL and parses the params appropriately.

      I've attached a small patch that uses this new code and resolves all current popup/redirect issues linked with query params. It still uses $_POST in priority.

        Activity

        Hide
        Nicolas Connault added a comment -

        Actually it is possible to avoid these & entirely throughout Moodle. What confused me is that in several places I found this code:

        redirect($url->out());

        This should NEVER be used in a redirect, because that function always converts ampersands to &

        Instead, use

        redirect($url->out(false, array(), false));

        Show
        Nicolas Connault added a comment - Actually it is possible to avoid these & entirely throughout Moodle. What confused me is that in several places I found this code: redirect($url->out()); This should NEVER be used in a redirect, because that function always converts ampersands to & Instead, use redirect($url->out(false, array(), false));
        Hide
        Dan Poltawski added a comment -

        Closing won't fix in response to second comment

        Show
        Dan Poltawski added a comment - Closing won't fix in response to second comment

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: