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

Incorrect number of query params passed for rss feed when timed posts or groups are enabled

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.7, 2.3.4, 2.4, 2.5
    • Fix Version/s: 2.2.7, 2.3.4, 2.4.1
    • Component/s: Forum
    • Labels:
      None
    • Testing Instructions:
      Hide
      1. Visit <yoursite>/admin/settings.php?section=optionalsubsystems and check 'Enable RSS feeds'.
      2. Visit <yoursite>/admin/settings.php?section=modsettingforum and set 'Enable RSS feeds' to 'yes' and check 'Timed posts'.
      3. On course page select Users -> Groups.
      4. Create multiple groups and assign a student to one of these groups.
      5. Create a new forum activity and set 'RSS feed for this activity' to 'Discussions', set 'Number of RSS recent articles' to 10 and set 'Group mode' to 'Separate groups'.
      6. Click on the forum activity and create a forum discussion called 'Past' and set it to expire some time in the past and make it only available to a certain group.
      7. Create another forum discussion called 'Future' and set it to start some time in the future and make it only available to the group chosen above.
      8. Create another forum discussion called 'Present' with no time restrictions and make it only available to the group chosen above.
      9. Create another forum activity with the same settings as earlier, but with 'Group mode' set to 'No Groups'.
      10. For this new forum activity set the same forum discussions mentioned above except without restricting to a group.
      11. As student in the group you selected for the first forum activity, visit all the forum discussions created. Ensure you can not see the 'Future' or 'Past' topics, for the forum discussions you can see click on 'RSS feed of discussions' and ensure you do not get an error.
      12. Log in as a student NOT in the group you chose and click on the discussion. Ensure you can not see the 'Future' and 'Past' ones, as well as the one 'Present' forum discussion restricted to one group. For the forum discussions you can see click on 'RSS feed of discussions' and ensure you do not get an error.
      13. As an administrator change the setting 'RSS feed for this activity' for the forum to 'Posts'.
      14. Re-check the forums RSS feed as both students.
      Show
      Visit <yoursite>/admin/settings.php?section=optionalsubsystems and check 'Enable RSS feeds'. Visit <yoursite>/admin/settings.php?section=modsettingforum and set 'Enable RSS feeds' to 'yes' and check 'Timed posts'. On course page select Users -> Groups. Create multiple groups and assign a student to one of these groups. Create a new forum activity and set 'RSS feed for this activity' to 'Discussions', set 'Number of RSS recent articles' to 10 and set 'Group mode' to 'Separate groups'. Click on the forum activity and create a forum discussion called 'Past' and set it to expire some time in the past and make it only available to a certain group. Create another forum discussion called 'Future' and set it to start some time in the future and make it only available to the group chosen above. Create another forum discussion called 'Present' with no time restrictions and make it only available to the group chosen above. Create another forum activity with the same settings as earlier, but with 'Group mode' set to 'No Groups'. For this new forum activity set the same forum discussions mentioned above except without restricting to a group. As student in the group you selected for the first forum activity, visit all the forum discussions created. Ensure you can not see the 'Future' or 'Past' topics, for the forum discussions you can see click on 'RSS feed of discussions' and ensure you do not get an error. Log in as a student NOT in the group you chose and click on the discussion. Ensure you can not see the 'Future' and 'Past' ones, as well as the one 'Present' forum discussion restricted to one group. For the forum discussions you can see click on 'RSS feed of discussions' and ensure you do not get an error. As an administrator change the setting 'RSS feed for this activity' for the forum to 'Posts'. Re-check the forums RSS feed as both students.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-36741_master

      Description

      Noticed the following error while testing MDL-30377.

      ERROR: Incorrect number of query parameters. Expected 4, got 0.
      line 800 of /lib/dml/moodle_database.php: dml_exception thrown
      line 1018 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->fix_sql_params()
      line 116 of /mod/forum/rsslib.php: call to mysqli_native_moodle_database->get_records_sql()
      line 78 of /mod/forum/rsslib.php: call to forum_rss_newstuff()
      line 168 of /rss/file.php: call to forum_rss_get_feed()

      Steps to replicate:

      1. Visit <yoursite>/admin/settings.php?section=optionalsubsystems and check 'enable RSS feeds'.
      2. Visit <yoursite>/admin/settings.php?section=modsettingforum and set 'Enable RSS feeds' to 'yes' and check 'Timed posts'.
      3. On course page select Users -> Groups.
      4. Create multiple groups and assign a student to one of these groups.
      5. Create a new forum and set 'RSS feed for this activity' to 'Discussions', set 'Number of RSS recent articles' to 10 and set 'Group mode' to 'Separate groups'.
      6. Click on the forum activity and create a forum discussion called 'Past' and set it to expire some time in the past.
      7. Create another forum discussion called 'Future' and set it to start some time in the future.
      8. Create a bunch of other forum discussions that do not expire.
      9. As student, visit the forum discussion
      10. Under forum admin, click on 'RSS feed of discussions'

      It will show the error.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              markn Mark Nelson
              Reporter:
              rwijaya Rossiani Wijaya
              Peer reviewer:
              Frédéric Massart
              Integrator:
              Sam Hemelryk
              Tester:
              David Monllaó
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Jan/13