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

Warning Undefined property: stdClass::$defaultuserroleid when running CLI install script

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: Web Services
    • Labels:
      None

      Description

      Eloy wrote in MDL-27551:

      To reproduce: Install Moodle 2.1 with the CLI installer, you will get:

      Moodle 2.1dev (Build: 20110602) command line installation program
      -->System
      PHP Notice: Undefined property: stdClass::$defaultuserroleid in /Users/Shared/Jenkins/Home/moodle_integration_git/lib/adminlib.php on line 6510
      PHP Stack trace:
      PHP 1.

      {main}

      () /Users/Shared/Jenkins/Home/moodle_integration_git/admin/cli/install.php:0
      PHP 2. install_cli_database() /Users/Shared/Jenkins/Home/moodle_integration_git/admin/cli/install.php:648
      PHP 3. install_core() /Users/Shared/Jenkins/Home/moodle_integration_git/lib/installlib.php:555
      PHP 4. admin_apply_default_settings() /Users/Shared/Jenkins/Home/moodle_integration_git/lib/upgradelib.php:1376
      PHP 5. admin_apply_default_settings() /Users/Shared/Jenkins/Home/moodle_integration_git/lib/adminlib.php:5855
      PHP 6. admin_apply_default_settings() /Users/Shared/Jenkins/Home/moodle_integration_git/lib/adminlib.php:5855
      PHP 7. admin_apply_default_settings() /Users/Shared/Jenkins/Home/moodle_integration_git/lib/adminlib.php:5855
      PHP 8. admin_setting_enablemobileservice->write_setting() /Users/Shared/Jenkins/Home/moodle_integration_git/lib/adminlib.php:5869
      PHP 9. admin_setting_enablemobileservice->set_xmlrpc_cap() /Users/Shared/Jenkins/Home/moodle_integration_git/lib/adminlib.php:6634
      PHP 10. admin_setting_enablemobileservice->is_xmlrpc_cap_allowed() /Users/Shared/Jenkins/Home/moodle_integration_git/lib/adminlib.php:6528
      It seems that you are trying to use $defaultuserroleid before it has been defined, so it fails and I guess it causes the behavior of is_xmlrpc_cap_allowed() to fail too.

      Surely that code needs to check if we are in early installation stages - during_initial_install() - and act in consequence. Or be executed later - lib/db/install.php - or whatever but current incarnation seems wrong.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    1/Jul/11