Not sending enough parameters to "useroverquotathreshold" lang string

Bug #1606435 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Low
Aaron Wells
15.04
Fix Released
Low
Aaron Wells
15.10
Fix Released
Low
Aaron Wells
16.04
Fix Released
Low
Aaron Wells
16.10
Fix Released
Low
Aaron Wells

Bug Description

The lang string "useroverquotathreshold" in artefact.file.php expects three sprintf parameters, but in the two places we use it, we only use one parameter. As a result, it prints a warning message to the error logs, and the string it should print is replaced with an empty string.

Here's the warning message:

 [WAR] 37 (lib/mahara.php:1418) sprintf(): Too few arguments
 Call stack (most recent first):
   * log_message("sprintf(): Too few arguments", 8, true, true, "/home/aaronw/www/mahara/htdocs/lib/mahara.php", 1418) at /home/aaronw/www/mahara/htdocs/lib/errors.php:489
   * error(2, "sprintf(): Too few arguments", "/home/aaronw/www/mahara/htdocs/lib/mahara.php", 1418, array(size 3)) at Unknown:0
   * sprintf("User %s has arrived at %s%% percent of their %s qu...", "user1 user1 (user1)") at Unknown:0
   * call_user_func_array("sprintf", array(size 2)) at /home/aaronw/www/mahara/htdocs/lib/mahara.php:1418
   * format_langstring("User %s has arrived at %s%% percent of their %s qu...", array(size 1), "en.utf8") at /home/aaronw/www/mahara/htdocs/lib/mahara.php:505
   * get_string_location("useroverquotathreshold", "artefact.file", array(size 1)) at /home/aaronw/www/mahara/htdocs/lib/mahara.php:294
   * get_string("useroverquotathreshold", "artefact.file", "user1 user1 (user1)") at /home/aaronw/www/mahara/htdocs/admin/users/edit.php:405
   * edituser_site_submit(object(Pieform), array(size 16)) at Unknown:0
   * call_user_func_array("edituser_site_submit", array(size 2)) at /home/aaronw/www/mahara/htdocs/lib/pieforms/pieform.php:540
   * Pieform->__construct(array(size 6)) at /home/aaronw/www/mahara/htdocs/lib/pieforms/pieform.php:161
   * Pieform::process(array(size 6)) at /home/aaronw/www/mahara/htdocs/lib/mahara.php:4730
   * pieform(array(size 6)) at /home/aaronw/www/mahara/htdocs/admin/users/edit.php:265

Revision history for this message
Aaron Wells (u-aaronw) wrote :

This lang string prints a message saying that a particular user is over their quota threshold. It is used in two situations:

1. When you're an admin on the institution config page, and you are reducing the quota for an institution that you are a member of, and the new quota is below your current file usage.

2. When you're an admin editing the account settings of a user, and you reduce their quota below their current file usage.

Revision history for this message
Aaron Wells (u-aaronw) wrote :

To replicate (case 1):

1. Log in as admin
2. Go to "Contents -> Files" and upload a 1 MB file.
3. Go to "Administration -> Institutions" and click "Add institution" to create a new institution.
4. Give the new institution the name "Institution A" and save it.
5. Go to "Administration -> Institutions -> Members" and add the admin user to Institution A.
6. Go to "Administration -> Institutions" and click the edit link for Institution A, to go to the edit config page.
7. Set "Default quota" to 500 Kilobytes, and "Update user quotas" to "Yes".
8. Click "Submit"

Expected result: You see a notification telling you that you are now over the quota.
Actual result: You see the "Too few parameters" warning message in the error logs, and you see an empty pink session message area on the page.

Revision history for this message
Aaron Wells (u-aaronw) wrote :

To replicate (Case 2):

1. Create a user named "User A"
2. Log in as User A
3. Go to "Contents -> Files" and upload a 1 MB file.
4. Log out as User A
5. Log in as admin
6. Go to the account settings for User A
7. Set "File quota" to 500 Kilobytes, and click "Save changes"

Expected result: You see a session message about how the user is now over their file storage threshold.

Actual result: You see the "too few parameters" warning in the error logs, and an empty pink session message area on the page.

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

Patch for "master" branch: https://reviews.mahara.org/6753

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

Reviewed: https://reviews.mahara.org/6753
Committed: https://git.mahara.org/mahara/mahara/commit/f4ed391a7581d6556dfd46c2bcb5831d1d5e700e
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit f4ed391a7581d6556dfd46c2bcb5831d1d5e700e
Author: Aaron Wells <email address hidden>
Date: Tue Jul 26 17:28:29 2016 +1200

Bug 1606435: Too few parameters sent to lang string

Change-Id: I69d51c750fbcf605f98a5825fc8af1113719b723
behatnotneeded: Test to come later

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

Patch for "16.04_STABLE" branch: https://reviews.mahara.org/6778

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "15.10_STABLE" branch: https://reviews.mahara.org/6779

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/6780

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

Reviewed: https://reviews.mahara.org/6779
Committed: https://git.mahara.org/mahara/mahara/commit/8e97a2422225c24b500089c2a8ce79bbe62c65d6
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.10_STABLE

commit 8e97a2422225c24b500089c2a8ce79bbe62c65d6
Author: Aaron Wells <email address hidden>
Date: Tue Jul 26 17:28:29 2016 +1200

Bug 1606435: Too few parameters sent to lang string

Change-Id: I69d51c750fbcf605f98a5825fc8af1113719b723
behatnotneeded: Test to come later
(cherry picked from commit f4ed391a7581d6556dfd46c2bcb5831d1d5e700e)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6778
Committed: https://git.mahara.org/mahara/mahara/commit/05cde942044b44eb9277b09aaf4e80a46abe8d42
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.04_STABLE

commit 05cde942044b44eb9277b09aaf4e80a46abe8d42
Author: Aaron Wells <email address hidden>
Date: Tue Jul 26 17:28:29 2016 +1200

Bug 1606435: Too few parameters sent to lang string

Change-Id: I69d51c750fbcf605f98a5825fc8af1113719b723
behatnotneeded: Test to come later
(cherry picked from commit f4ed391a7581d6556dfd46c2bcb5831d1d5e700e)

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6780
Committed: https://git.mahara.org/mahara/mahara/commit/8bfadcd09f2d7abfbea9bab52554f793de00248f
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 8bfadcd09f2d7abfbea9bab52554f793de00248f
Author: Aaron Wells <email address hidden>
Date: Tue Jul 26 17:28:29 2016 +1200

Bug 1606435: Too few parameters sent to lang string

Change-Id: I69d51c750fbcf605f98a5825fc8af1113719b723
behatnotneeded: Test to come later
(cherry picked from commit f4ed391a7581d6556dfd46c2bcb5831d1d5e700e)

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.0 → none
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.