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

Square brackets in url parameter are removed by moodle_url

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.1.5, 2.2.2
    • 2.0.4, 2.1.4, 2.2.1, 2.3
    • Libraries

      With PHP, it is possible to pass an array as URL parameter like this:
      http://www.yourphpsite.com/index.php?foo[]=bar&foo[]=bar2

      I'm not sure if that kind of URL is RFC compliant, but at least it works and is sometimes used by delevopers.
      I realized now that the square brackets in such a URL are removed when they are fed into a moodle_url class.

      To reproduce this:

      • Add a rss reader block to your course
      • Add the rss feed http://www.uni-ulm.de/index.php?id=10794 to the rss reader. This feed is based on the ttnews extension for typo3.
      • View the feed entries in the block

      Links to a feed entry in this feed look like this:
      http://www.uni-ulm.de/index.php?id=10719&tx_ttnews[tt_news]=7245&cHash=ac6e21dc232f5607fd3265ebd4339758
      but they are displayed like this:
      http://www.uni-ulm.de/index.php?id=10719&tx_ttnews=&cHash=ac6e21dc232f5607fd3265ebd4339758

      Additionally, there is a debug message in apache log which says:
      Warning: rawurlencode() expects parameter 1 to be string, array given in /pathtomoodle/lib/weblib.php on line 497 Warning: rawurlencode() expects parameter 1 to be string, array given in /pathtomoodle/lib/weblib.php on line 497

      I would be grateful if you could check if URLs like these should be allowed in moodle_url class or not.

            timhunt Tim Hunt
            abias Alexander Bias
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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