← Back to team overview

mahara-contributors team mailing list archive

[Bug 1958499] A change has been merged

 

Reviewed:  https://reviews.mahara.org/12370
Committed: https://git.mahara.org/mahara/mahara/commit/1487803c87aae138bc27445b15a7849e10ec67c3
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch:    20.10_DEV

commit 1487803c87aae138bc27445b15a7849e10ec67c3
Author: Ghada El-Zoghbi <ghada@xxxxxxxxxxxxxxx>
Date:   Fri Jan 21 09:04:46 2022 +1300

Bug 1958499: Failed user upload csv email problem

The accumulated failed users array is not being set correctly
as it resets on every loop

Change-Id: Ic1f7abf0197bad29502c6f651dacf19c8c41e320
Signed-off-by: Robert Lyon <robertl@xxxxxxxxxxxxxxx>
(cherry picked from commit 0e8e1151460b2d1dbc9ea54187b8ba53c0201c97)

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1958499

Title:
  Upload CSV Users Bug with Failed Emails

Status in Mahara:
  Fix Committed
Status in Mahara 20.10 series:
  Fix Committed
Status in Mahara 21.04 series:
  Fix Committed
Status in Mahara 21.10 series:
  Fix Committed
Status in Mahara 22.04 series:
  Fix Committed

Bug description:
  Mahara: 21.10.0
  OS: Linux 20.04
  DB: Postgres
  Browser: n/a

  While implementing a customisation for a client, we identified a very
  old bug in htdocs/admin/users/uploadcsv.php.

  The setting of the `$failedusers` array on line 639 occurs within the
  foreach loop. Which means, the data in the $failedusers array gets
  reset after each iteration.

  The initialisation of $failedusers should occur outside of the foreach
  loop.

  
  https://github.com/MaharaProject/mahara/blob/main/htdocs/admin/users/uploadcsv.php#L644-L667

  
  This is the current code at line 637:

  if ($values['emailusers'] && $addedusers) {
          foreach ($addedusers as $user) {
              $failedusers = array();
              try {
              ...

  It should be:

  if ($values['emailusers'] && $addedusers) {
          $failedusers = array();     <- MOVE outside the foreach loop
          foreach ($addedusers as $user) {
              try {
              ...

  
  Hope that makes sense.

  Thank you.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1958499/+subscriptions



References