-
Bug
-
Resolution: Fixed
-
Minor
-
4.1
lib/dml/moodle_transaction.php |
|
101
|
public function rollback($e) { |
102
|
if ($this->is_disposed()) { |
103
|
throw new dml_transaction_exception('Transactions already disposed', $this); |
104
|
}
|
105
|
$this->database->rollback_delegated_transaction($this, $e); |
106
|
}
|
grade/classes/external/create_gradecategories.php |
|
226
|
try { |
227
|
$transaction = $DB->start_delegated_transaction(); |
228
|
\grade_edit_tree::update_gradecategory($gradecategory, (object) $data); |
229
|
$transaction->allow_commit(); |
230
|
$createdcats[] = $gradecategory->id; |
231
|
} catch (\Exception $e) { |
232
|
// If the submitted data was broken for any reason. |
233
|
$warnings['database'] = $e->getMessage(); |
234
|
$transaction->rollback(); |
235
|
return ['warnings' => $warnings]; |
236
|
}
|
rollback needs to be passed an exception. If this code is ever called an ArgumentCountError will be thrown.
To replicate:
- Hack grade/edit/tree/lib.php such that the update_gradecategory method immediately throws an exception:
public static function update_gradecategory(grade_category $gradecategory, stdClass $data) {
throw new \Exception('exception in update_gradecategory');
- Run the test.php script attached to this issue from the root of your moodle installation:
php test.php
- has a non-specific relationship to
-
MDL-71031 Batch create API for grade categories
- Closed