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

External get_discussion_posts() results in unexpected debugging when trying to export posts with ratings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.9.3, 3.10
    • Fix Version/s: None
    • Component/s: Forum
    • Labels:
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE

      Description

      This is a bug discovered on MDL-65252 but will only be patched there for master and 3.11. This issue is about backporting the bug fix.

      test_mod_forum_get_discussion_rating_information  (renamed in the linked issue, so won't exist in stables just yet) should work with the new API method get_discussion_posts(), but results in an unexpected debugging call when fetching the posts as a teacher using this. It used to work with get_forum_discussion_posts() but that's just been finally deprecated (or is about to be).

      This seems to be caused by a bad returnurl on the rating, which means execution falls through and tries to use the $PAGE var, which isn't set up properly, hence debugging is called.
      https://github.com/snake/moodle/blob/1896b8009a6fdd55ea516b2fec21c3bffbc447ff/rating/lib.php#L342

      At present, we're commenting out that test chunk. If you uncomment it, you'll see:

      Unexpected debugging() call detected.
      Debugging: This page did not call $PAGE->set_url(...). Using 
      * line 610 of /lib/pagelib.php: call to debugging()
      * line 830 of /lib/pagelib.php: call to moodle_page->magic_get_url()
      * line 342 of /rating/lib.php: call to moodle_page->__get()
      * line 2297 of /lib/outputrenderers.php: call to rating->get_rate_url()
      * line 230 of /lib/outputrenderers.php: call to core_renderer->render_rating()
      * line 481 of /lib/outputrenderers.php: call to renderer_base->render()
      * line 475 of /mod/forum/classes/local/exporters/post.php: call to plugin_renderer_base->render()
      * line 125 of /lib/classes/external/exporter.php: call to mod_forum\local\exporters\post->get_other_values()
      * line 146 of /mod/forum/classes/local/exporters/posts.php: call to core\external\exporter->export()
      * line ? of unknownfile: call to mod_forum\local\exporters\posts->mod_forum\local\exporters\{closure}()
      * line 148 of /mod/forum/classes/local/exporters/posts.php: call to array_map()
      * line 125 of /lib/classes/external/exporter.php: call to mod_forum\local\exporters\posts->get_other_values()
      * line 173 of /mod/forum/classes/local/builders/exported_posts.php: call to core\external\exporter->export()
      * line 228 of /mod/forum/externallib.php: call to mod_forum\local\builders\exported_posts->build()
      * line 1810 of /mod/forum/tests/externallib_test.php: call to mod_forum_external::get_discussion_posts()
      * line 1415 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to mod_forum_external_testcase->test_mod_forum_get_forum_discussion_rating_information()
      * line 1035 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit\Framework\TestCase->runTest()
      * line 80 of /lib/phpunit/classes/advanced_testcase.php: call to PHPUnit\Framework\TestCase->runBare()
      * line 691 of /vendor/phpunit/phpunit/src/Framework/TestResult.php: call to advanced_testcase->runBare()
      * line 763 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit\Framework\TestResult->run()
      * line 597 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestCase->run()
      * line 597 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestSuite->run()
      * line 627 of /vendor/phpunit/phpunit/src/TextUI/TestRunner.php: call to PHPUnit\Framework\TestSuite->run()
      * line 204 of /vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit\TextUI\TestRunner->doRun()
      * line 163 of /vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit\TextUI\Command->run()
      * line 61 of /vendor/phpunit/phpunit/phpunit: call to PHPUnit\TextUI\Command::main() 

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jaked Jake Dallimore
              Participants:
              Component watchers:
              Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: