Shared access with users produces a warning in 19.10 when search results count = 0

Bug #1871249 reported by Lisa Seeto
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Lisa Seeto
19.04
Fix Released
High
Unassigned
19.10
Fix Released
High
Unassigned

Bug Description

The code currently in 19.10 to share access with 'Users' will produce a warning when the search count is 0, i.e a site that has no current users. It's possible there are other ways to return a User search count of 0 but this is the most reliable for testing purposes.

The warning message is:
[WAR] c4 (view/access.json.php:60) Invalid argument supplied for foreach()

To reproduce:
1. On a fresh install of Mahara 19.10 codebase with no users, create a page.
2. Navigate to "Share" and select to edit share access for the new page
3. Select "User" from dropdown box and scroll on the drop down to select a User (it will say No results found)
4. Refresh the page
Expected results:
Page displays no warnings
Actual results:
Page displays with a warning message

This is happening in 19.10 (possibly a fix needs to be applied to earlier versions of the code). This issue didn't affect code after 19.10.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "19.10_STABLE" branch: https://reviews.mahara.org/10859

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/10859
Committed: https://git.mahara.org/mahara/mahara/commit/fb3f7e75bfb477587a02ce2712bf621f9b0f55d6
Submitter: Robert Lyon (<email address hidden>)
Branch: 19.10_STABLE

commit fb3f7e75bfb477587a02ce2712bf621f9b0f55d6
Author: Lisa Seeto <email address hidden>
Date: Tue Apr 7 12:32:52 2020 +1200

Bug 1871249: Shared access with users produces a warning in 19.10 when search results count = 0

- added in check for when data['data'] is empty for user search
- refactored friends, default cases as it was using the same code
- clean up unused variable

Change-Id: I5e73ff0894bee57f945fdc6b347ee5a9100d1bd4
Signed-off-by: Lisa Seeto <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "19.04_STABLE" branch: https://reviews.mahara.org/10896

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/10896
Committed: https://git.mahara.org/mahara/mahara/commit/46156bda60ac26173cf001358b6e73a1cc871708
Submitter: Robert Lyon (<email address hidden>)
Branch: 19.04_STABLE

commit 46156bda60ac26173cf001358b6e73a1cc871708
Author: Lisa Seeto <email address hidden>
Date: Tue Apr 7 12:32:52 2020 +1200

Bug 1871249: Shared access with users produces a warning in 19.10 when search results count = 0

- added in check for when data['data'] is empty for user search
- refactored friends, default cases as it was using the same code
- clean up unused variable

Change-Id: I5e73ff0894bee57f945fdc6b347ee5a9100d1bd4
Signed-off-by: Lisa Seeto <email address hidden>
(cherry picked from commit fb3f7e75bfb477587a02ce2712bf621f9b0f55d6)

Robert Lyon (robertl-9)
no longer affects: mahara/18.10
Changed in mahara:
status: In Progress → Fix Committed
Doris Tam (doristam)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.