MDL-77462 core_question: avoid passing null to preg_match

This commit is contained in:
Tim Hunt
2023-03-03 08:46:00 +00:00
parent 556208417d
commit de086efd41
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1982,7 +1982,7 @@ function core_question_find_next_unused_idnumber(?string $oldidnumber, int $cate
global $DB;
// The the old idnumber is not of the right form, bail now.
if (!preg_match('~\d+$~', $oldidnumber, $matches)) {
if ($oldidnumber === null || !preg_match('~\d+$~', $oldidnumber, $matches)) {
return null;
}