MDL-60281 general: function each() is deprecated in PHP7.2

This commit is contained in:
Marina Glancy
2017-10-16 09:37:20 +08:00
parent 484b43f456
commit 33683bc80c
11 changed files with 29 additions and 20 deletions
+6 -3
View File
@@ -126,7 +126,8 @@ class workshop_random_allocator implements workshop_allocator {
$allreviewers = $reviewers[0];
$allreviewersreloaded = false;
foreach ($newallocations as $newallocation) {
list($reviewerid, $authorid) = each($newallocation);
$reviewerid = key($newallocation);
$authorid = current($newallocation);
$a = new stdClass();
if (isset($allreviewers[$reviewerid])) {
$a->reviewername = fullname($allreviewers[$reviewerid]);
@@ -324,7 +325,8 @@ class workshop_random_allocator implements workshop_allocator {
$submissions = $this->workshop->get_submissions($authorids);
$submissions = $this->index_submissions_by_authors($submissions);
foreach ($newallocations as $newallocation) {
list($reviewerid, $authorid) = each($newallocation);
$reviewerid = key($newallocation);
$authorid = current($newallocation);
if (!isset($submissions[$authorid])) {
throw new moodle_exception('unabletoallocateauthorwithoutsubmission', 'workshop');
}
@@ -408,7 +410,8 @@ class workshop_random_allocator implements workshop_allocator {
continue;
}
foreach ($newallocations as $newallocation) {
list($nrid, $naid) = each($newallocation);
$nrid = key($newallocation);
$naid = current($newallocation);
if (array($arid, $aaid) == array($nrid, $naid)) {
// re-allocation found - let us continue with the next assessment
$keepids[$assessmentid] = null;