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

Adding a resource throws PHP errors in an empty course

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: Gradebook
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      The course in "topic" format is empty and set to 1 topic. The forum in topic 0 is deleted. News entries to show is set to 0. Debugging is set to "normal". In other courses in the same Moodle installation I can add resources without errors.

      When I try to add a resource the following bug trace is shown (XDebug installed).

      Warning: Missing argument 1 for grade_category::fetch_course_category(), called in /home/urs/workspace/moodle_19_test/lib/gradelib.php on line 632 and defined in /home/urs/workspace/moodle_19_test/lib/grade/grade_category.php on line 1089
      Call Stack

      1. Time Memory Function Location
        1 0.0029 200340 {main}( ) ../modedit.php:0
        2 0.4102 17995136 moodleform_mod->moodleform_mod( ) ../modedit.php:182
        3 0.4102 17995268 moodleform->moodleform( ) ../moodleform_mod.php:40
        4 0.4154 18144836 mod_quiz_mod_form->definition( ) ../formslib.php:120
        5 0.6494 19326020 moodleform_mod->standard_coursemodule_elements( ) ../mod_form.php:218
        6 0.6547 19357532 grade_get_categories_menu( ) ../moodleform_mod.php:258
        7 0.6553 19361216 grade_category::fetch_course_category( ) ../gradelib.php:632

        ( ! ) Notice: Undefined variable: courseid in /home/urs/workspace/moodle_19_test/lib/grade/grade_category.php on line 1092
        Call Stack
        # Time Memory Function Location
        1 0.0029 200340 {main}

        ( ) ../modedit.php:0
        2 0.4102 17995136 moodleform_mod->moodleform_mod( ) ../modedit.php:182
        3 0.4102 17995268 moodleform->moodleform( ) ../moodleform_mod.php:40
        4 0.4154 18144836 mod_quiz_mod_form->definition( ) ../formslib.php:120
        5 0.6494 19326020 moodleform_mod->standard_coursemodule_elements( ) ../mod_form.php:218
        6 0.6547 19357532 grade_get_categories_menu( ) ../moodleform_mod.php:258
        7 0.6553 19361216 grade_category::fetch_course_category( ) ../gradelib.php:632

      ( ! ) Notice: Undefined variable: courseid in /home/urs/workspace/moodle_19_test/lib/grade/grade_category.php on line 1098
      Call Stack

      1. Time Memory Function Location
        1 0.0029 200340 {main}( ) ../modedit.php:0
        2 0.4102 17995136 moodleform_mod->moodleform_mod( ) ../modedit.php:182
        3 0.4102 17995268 moodleform->moodleform( ) ../moodleform_mod.php:40
        4 0.4154 18144836 mod_quiz_mod_form->definition( ) ../formslib.php:120
        5 0.6494 19326020 moodleform_mod->standard_coursemodule_elements( ) ../mod_form.php:218
        6 0.6547 19357532 grade_get_categories_menu( ) ../moodleform_mod.php:258
        7 0.6553 19361216 grade_category::fetch_course_category( ) ../gradelib.php:632
        Column 'courseid' cannot be null

        INSERT INTO mdl_grade_categories ( COURSEID, PARENT, DEPTH, PATH, FULLNAME, AGGREGATION, KEEPHIGH, DROPLOW, AGGREGATEONLYGRADED, AGGREGATEOUTCOMES, AGGREGATESUBCATS, TIMECREATED, TIMEMODIFIED ) VALUES ( null, null, 0, null, 'Course grade category', 0, 0, 0, 0, 0, 0, 1201002259, 1201002259 )

        * line 1532 of lib/dmllib.php: call to debugging()
        * line 290 of lib/grade/grade_object.php: call to insert_record()
        * line 328 of lib/grade/grade_category.php: call to grade_object->insert()
        * line 1098 of lib/grade/grade_category.php: call to grade_category->insert_course_category()
        * line 632 of lib/gradelib.php: call to grade_category::fetch_course_category()
        * line 258 of course/moodleform_mod.php: call to grade_get_categories_menu()
        * line 218 of mod/quiz/mod_form.php: call to moodleform_mod->standard_coursemodule_elements()
        * line 120 of lib/formslib.php: call to mod_quiz_mod_form->definition()
        * line 40 of course/moodleform_mod.php: call to moodleform->moodleform()
        * line 182 of course/modedit.php: call to moodleform_mod->moodleform_mod()

        Could not insert object into db

        * line 291 of lib/grade/grade_object.php: call to debugging()
        * line 328 of lib/grade/grade_category.php: call to grade_object->insert()
        * line 1098 of lib/grade/grade_category.php: call to grade_category->insert_course_category()
        * line 632 of lib/gradelib.php: call to grade_category::fetch_course_category()
        * line 258 of course/moodleform_mod.php: call to grade_get_categories_menu()
        * line 218 of mod/quiz/mod_form.php: call to moodleform_mod->standard_coursemodule_elements()
        * line 120 of lib/formslib.php: call to mod_quiz_mod_form->definition()
        * line 40 of course/moodleform_mod.php: call to moodleform->moodleform()
        * line 182 of course/modedit.php: call to moodleform_mod->moodleform_mod()

        Could not insert this category: grade_category Object ( [table] => grade_categories [required_fields] => Array ( [0] => id [1] => courseid [2] => parent [3] => depth [4] => path [5] => fullname [6] => aggregation [7] => keephigh [8] => droplow [9] => aggregateonlygraded [10] => aggregateoutcomes [11] => aggregatesubcats [12] => timecreated [13] => timemodified ) [courseid] => [parent] => [parent_category] => [depth] => 0 [path] => [fullname] => Course grade category [aggregation] => 0 [keephigh] => 0 [droplow] => 0 [aggregateonlygraded] => 0 [aggregateoutcomes] => 0 [aggregatesubcats] => 0 [children] => [all_children] => [grade_item] => [sortorder] => [forceable] => Array ( [0] => aggregation [1] => keephigh [2] => droplow [3] => aggregateonlygraded [4] => aggregateoutcomes [5] => aggregatesubcats ) [optional_fields] => Array ( ) [id] => [timecreated] => 1201002259 [timemodified] => 1201002259 )

        * line 329 of lib/grade/grade_category.php: call to debugging()
        * line 1098 of lib/grade/grade_category.php: call to grade_category->insert_course_category()
        * line 632 of lib/gradelib.php: call to grade_category::fetch_course_category()
        * line 258 of course/moodleform_mod.php: call to grade_get_categories_menu()
        * line 218 of mod/quiz/mod_form.php: call to moodleform_mod->standard_coursemodule_elements()
        * line 120 of lib/formslib.php: call to mod_quiz_mod_form->definition()
        * line 40 of course/moodleform_mod.php: call to moodleform->moodleform()
        * line 182 of course/modedit.php: call to moodleform_mod->moodleform_mod()


        ( ! ) Warning: Invalid argument supplied for foreach() in /home/urs/workspace/moodle_19_test/lib/gradelib.php on line 638
        Call Stack
        # Time Memory Function Location
        1 0.0029 200340 {main}

        ( ) ../modedit.php:0
        2 0.4102 17995136 moodleform_mod->moodleform_mod( ) ../modedit.php:182
        3 0.4102 17995268 moodleform->moodleform( ) ../moodleform_mod.php:40
        4 0.4154 18144836 mod_quiz_mod_form->definition( ) ../formslib.php:120
        5 0.6494 19326020 moodleform_mod->standard_coursemodule_elements( ) ../mod_form.php:218
        6 0.6547 19357532 grade_get_categories_menu( ) ../moodleform_mod.php:258

      ( ! ) Warning: Invalid argument supplied for foreach() in /home/urs/workspace/moodle_19_test/lib/gradelib.php on line 648
      Call Stack

      1. Time Memory Function Location
        1 0.0029 200340 {main}

        ( ) ../modedit.php:0
        2 0.4102 17995136 moodleform_mod->moodleform_mod( ) ../modedit.php:182
        3 0.4102 17995268 moodleform->moodleform( ) ../moodleform_mod.php:40
        4 0.4154 18144836 mod_quiz_mod_form->definition( ) ../formslib.php:120
        5 0.6494 19326020 moodleform_mod->standard_coursemodule_elements( ) ../mod_form.php:218
        6 0.6547 19357532 grade_get_categories_menu( ) ../moodleform_mod.php:258

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            urshunkler Urs Hunkler
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Mar/08