Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-3556

Mobile app site check causes unnecessary errors in server log

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.9.3
    • 3.9.2
    • Log in screen
    • Hide

      This test just confirms that the check isn't broken by adding the parameter:

      1. Start the mobile app with no data (the easiest way to do this is using Moodle Desktop, open developer tools, then go to the Application tab and clear storage, then press F5 to reload).
      2. Click 'I'm a learner' and type or paste in the URL to your site, then select it to proceed to the login screen. (You do not need to actually log in but you should see the login/password fields.)
        • EXPECTED: You get to the login screen without error.

      Only if the Moodle site you are connected to has MDL-69759 applied then you can also do the following steps:

      1. Examine the web server error log for your Moodle server, looking for errors at the time that you did the login.
        • EXPECTED: There are no errors at that time. Specifically, there is no error like the following: 'Default exception handler: A required parameter (username) was missing'
      Show
      This test just confirms that the check isn't broken by adding the parameter: Start the mobile app with no data (the easiest way to do this is using Moodle Desktop, open developer tools, then go to the Application tab and clear storage, then press F5 to reload). Click 'I'm a learner' and type or paste in the URL to your site, then select it to proceed to the login screen. (You do not need to actually log in but you should see the login/password fields.) EXPECTED: You get to the login screen without error. Only if the Moodle site you are connected to has MDL-69759 applied then you can also do the following steps: Examine the web server error log for your Moodle server, looking for errors at the time that you did the login. EXPECTED: There are no errors at that time. Specifically, there is no error like the following: 'Default exception handler: A required parameter (username) was missing'
    • MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • Moodle App 3.9.3

      The siteExists function makes a call to Moodle /login/token.php with no parameters:

          siteExists(siteUrl: string): Promise<void> {
              return this.http.post(siteUrl + '/login/token.php', {}).timeout(this.wsProvider.getRequestTimeout()).toPromise()
      

      If everything else is configured correctly, /login/token.php fails because of the following PHP line:

      $username = required_param('username', PARAM_USERNAME);
      

      The app is expecting this failure so it works OK, but this ends up cluttering up the logs with a bunch of entries like this:

      [18-Sep-2020 06:24:28 Europe/London] Default exception handler: A required parameter (username) was missing Debug: Error code: missingparam

      • line 494 of /lib/setuplib.php: moodle_exception thrown
      • line 562 of /lib/moodlelib.php: call to print_error()
      • line 34 of /login/token.php: call to required_param()

      Which makes it harder to spot genuine errors in the server logs. [I came across this error while trying to track down a problem...]

      I suggest this should be changed so that:

      • the app sends a specific parameter such as appsitecheck=1 when making this request
      • the Moodle code is changed so that if this optional parameter is supplied, then it exits without an error (before doing the require_param line above).

      This should not cause any problems relating to versioning because behaviour would be the same as present if either an older app version, or older Moodle version, were used.

            quen Sam Marshall
            quen Sam Marshall
            Pau Ferrer Pau Ferrer
            Juan Leyva Juan Leyva
            Dani Palou Dani Palou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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