Moodle
  1. Moodle
  2. MDL-29592

Icons are not shown while using $CFG->debugusers

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1/ Create a test user and note down the user ID, purge all caches
      2/ Add a "$CFG->debugusers = '[userid]';" to your config.php where [userid] is the id of the user just created.
      3/ Login to moodle using the test user and browse around ensuring that errors are not seen on each page

      Repeat with another user not in the debug users list.

      Show
      1/ Create a test user and note down the user ID, purge all caches 2/ Add a "$CFG->debugusers = ' [userid] ';" to your config.php where [userid] is the id of the user just created. 3/ Login to moodle using the test user and browse around ensuring that errors are not seen on each page Repeat with another user not in the debug users list.
    • Workaround:
      Hide

      Implement the change mentioned in the description

      Show
      Implement the change mentioned in the description
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Rank:
      19106

      Description

      When using $CFG->debugusers in config.php icons are not shown, because an error occurs while loading an icon. When trying to load an icon like theme/image.php?theme=standard&image=i%2Fnavigationitem an error like Notice: Trying to get property of non-object in /www/data/LearnWebTest/htdocs/LearnWebTest/live_image/lib/weblib.php on line 2842 occurs.

      In libweblib.php:2840 insert and $USER != null
      function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null) {
          global $CFG, $USER, $UNITTEST;
      
          $forcedebug = false;
          if (!empty($CFG->debugusers) and $USER != null) {
              $debugusers = explode(',', $CFG->debugusers);
      		$forcedebug = in_array($USER->id, $debugusers);
          }
      

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this and sharing the solution.

        I added $CFG->debugusers = '2'; to a config.php file.

        I didn't have any problem seeing icons, but I did see the error you reported.

        Show
        Michael de Raadt added a comment - Thanks for reporting this and sharing the solution. I added $CFG->debugusers = '2'; to a config.php file. I didn't have any problem seeing icons, but I did see the error you reported.
        Hide
        Dan Poltawski added a comment -

        To see the icon problem you need to purge your caches

        Show
        Dan Poltawski added a comment - To see the icon problem you need to purge your caches
        Hide
        Andrew Davis added a comment - - edited

        The code change looks fine. You just need to rework the testing instructions. Currently they're instructions explaining how to reproduce the bug so you just need to alter them a little to explain how to test the fix.

        Include a little explanation of what value to put in the config setting as its a setting most people won't know about.

        Also make sure you include testing with a user whose ID is in the config setting and a separate user whose ID is not there.

        Show
        Andrew Davis added a comment - - edited The code change looks fine. You just need to rework the testing instructions. Currently they're instructions explaining how to reproduce the bug so you just need to alter them a little to explain how to test the fix. Include a little explanation of what value to put in the config setting as its a setting most people won't know about. Also make sure you include testing with a user whose ID is in the config setting and a separate user whose ID is not there.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Integrated, thanks! (21, 22 & master)

        Show
        Eloy Lafuente (stronk7) added a comment - Integrated, thanks! (21, 22 & master)
        Hide
        Jason Fowler added a comment -

        All good

        Show
        Jason Fowler added a comment - All good
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Well,

        I wish I said it every time
        you do the things you do.
        You always lend a helping hand,
        and I'm filled with gratitude.

        You are strong and generous
        for each and everyone one of us.
        I am eternally grateful,
        I cannot say thanks enough.

        Sorry for the (un)cool bit above, lol. Closing this as fixed. Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Well, I wish I said it every time you do the things you do. You always lend a helping hand, and I'm filled with gratitude. You are strong and generous for each and everyone one of us. I am eternally grateful, I cannot say thanks enough. Sorry for the (un)cool bit above, lol. Closing this as fixed. Ciao

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: