Moodle
  1. Moodle
  2. MDL-23726

Incorrect return value of update_instance()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.8
    • Fix Version/s: 1.9.10, 2.0
    • Component/s: Assignment (2.2)
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      27112

      Description

      The function "update_instance()" in class assignment_base, file mod/assignment/lib.php, is documented as follows:

        /**
           * Updates a new assignment activity
           *
           * Given an object containing all the necessary data,
           * (defined by the form in mod.html) this function
           * will update the assignment instance and return the id number
           * The due date is updated in the calendar
           * This is common to all assignment types.
           *
           * @param $assignment object The data from the form on mod.html
           * @return int The assignment id
           */
      

      However, in the actual code, it does not return an assignment id. Rather, it always returns "true".

      This doesn't seem to cause malfunction, but it caused me some headache when developing a custom assignment type...

        Activity

        Hide
        Petr Škoda added a comment -

        Hello, insert functions return ids, update functions return bools. I am going to fix the docs now.

        Show
        Petr Škoda added a comment - Hello, insert functions return ids, update functions return bools. I am going to fix the docs now.
        Hide
        Petr Škoda added a comment -

        Fixed in CVS, thank you for the report.

        Petr Skoda

        Show
        Petr Škoda added a comment - Fixed in CVS, thank you for the report. Petr Skoda

          People

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

            Dates

            • Created:
              Updated:
              Resolved: