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

Coding error when using global $OUTPUT on several pages of tool_mfa

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.4, 4.5
    • Authentication

      We use a theme we have cloned from boost. While implementing a theme based version of drawers.php there was an error, when calling following pages.

      • admin/tool/mfa/user_preferences.php
      • admin/tool/mfa/action.php?factor=sms&action=manage
      • admin/tool/mfa/action.php?factor=webauthn&action=replace
      • admin/tool/mfa/action.php?factor=webauthn&action=setup

      Same error occurs, when a user failed finally to authenticate using multifactor authentication.

      The error disappears, when we remove the line:

      global $OUTPUT; 

      from our cloned drawers.php.

      We understand that this line may not be used but like to suggest following changes:

       

      Proposal:

      I'd like to suggest not to use

      $OUTPUT = $PAGE->get_renderer('tool_mfa');
      

      (in upper chars) although it is technically not a problem in the most cases, because a plugin renderer may call the relevant methods of the core_renderer.

       

      There is one place in tool_mfa where the global $OUTPUT object is really been overwritten (admin/tool/mfa/classes/manager.php::display_debug_notification()), what might have been avoided, when

      $output = $PAGE->get_renderer('tool_mfa'); 

      (in lower chars) is used as suggested here: https://moodledev.io/docs/4.4/apis/subsystems/output

       

      And there is another place, where the plugin renderer is initialized twice  (admin/tool/mfa/user_preferences.php)

        1. image-2024-09-23-14-28-35-089.png
          64 kB
          Andreas Wagner
        2. image-2024-09-23-14-33-34-387.png
          70 kB
          Andreas Wagner

            wagner139 Andreas Wagner
            wagner139 Andreas Wagner
            Meirza Meirza
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

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