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

          Issue Links

            Activity

            Hide
            jerome Jérôme Mouneyrac added a comment -

            no whitespaces, rebased, no need to bump version, 3 pull information added to the issue. Cheers

            Show
            jerome Jérôme Mouneyrac added a comment - no whitespaces, rebased, no need to bump version, 3 pull information added to the issue. Cheers
            Hide
            jerome Jérôme Mouneyrac added a comment -

            I tested with the cli install script the error disappear. I tested the function, still working.

            Show
            jerome Jérôme Mouneyrac added a comment - I tested with the cli install script the error disappear. I tested the function, still working.
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Jerome - this has been integrated now.

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Jerome - this has been integrated now.
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Also commenting I tested this on a standard installation (was apparent there as well) but it would still be good to test a CLI install as well.

            Show
            samhemelryk Sam Hemelryk added a comment - Also commenting I tested this on a standard installation (was apparent there as well) but it would still be good to test a CLI install as well.
            Hide
            jerome Jérôme Mouneyrac added a comment -

            Ah I tested only with the CLI Thanks for the integration Sam.

            Show
            jerome Jérôme Mouneyrac added a comment - Ah I tested only with the CLI Thanks for the integration Sam.
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Jerome - passed testing

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Jerome - passed testing
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Upstream, upstream, this is part of upstream, upstream... thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Upstream, upstream, this is part of upstream, upstream... thanks!

              People

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

                Dates

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