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

Notice: Undefined property: stdClass::$defaulthomepage in /var/www/html/moodle/index.php

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.1.6, 2.2.3
    • Component/s: General
    • Labels:
    • Testing Instructions:
      Hide
      1. Login as admin
      2. Enable developer debugging
      3. Remove config "defaulthomepage" from database (using phpmyadmin or any other tool)
      4. click on home page
      5. you should not see any notice, (also keep an eye on error log to make sure no notice/error is generated.)
      Show
      Login as admin Enable developer debugging Remove config "defaulthomepage" from database (using phpmyadmin or any other tool) click on home page you should not see any notice, (also keep an eye on error log to make sure no notice/error is generated.)
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      wip-mdl-32270

      Description

      I had upgraded my Moodle site from 1.9 to 2.2.2+.
      After upgrading the site I accessed front page, then I got a notice message "Notice: Undefined property: stdClass::$defaulthomepage in /var/www/html/moodle/index.php" on the top of the front page.
      I didn't use mymoodle on 1.9.

      So, if I change "Debug messages" from NORMAL to NONE, I'll not get the notice message. But now I'm debugging my Moodle2.2.2+ site.

      I modified moodle/index.php as follows for avoiding the notice;

      require_once('config.php');
      require_once($CFG->dirroot .'/course/lib.php');
      require_once($CFG->libdir .'/filelib.php');

      redirect_if_major_upgrade_required();

      $urlparams = array();
      // (Shirai): add from here
      // if (empty($CFG->defaulthomepage)) $CFG->defaulthomepage = NULL;
      // (Shirai): add to here
      if ($CFG->defaulthomepage == HOMEPAGE_MY && optional_param('redirect', 1, PARAM_BOOL) === 0)

      { $urlparams['redirect'] = 0; }

      $PAGE->set_url('/', $urlparams);
      $PAGE->set_course($SITE);

      This modification is not fundamental countermeasure.
      Why $CFG->defaulthomepage does not assigning any value (including NULL)?
      Which process of migrating is assign valid value of $CFG->defaulthomepage?

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/May/12