Problem with divide by zero when setting pagination limit

Bug #2002924 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Unassigned

Bug Description

For certain blocks there is the ability to set the 'count' (pagination limit) and if one sets it to a non integer value it causes the error:

 [DivisionByZeroError]: Modulo by zero

We need to set a rule for the field so that it can only be an integer, eg
  'rules' => array('integer' => true, 'minvalue' => 1, 'maxvalue' => 100),

To test:

1) Create a plan
2) create some tasks
3) Edit a page and add plan block to page

view page - all is fine

4) Edit the plan block and set 'count' to 'none'

On save - things hang
On page reload - see error

Can't edit page to fix problem so will mark this bug as high

Robert Lyon (robertl-9)
Changed in mahara:
status: New → Confirmed
milestone: none → 23.04.0
importance: Undecided → High
description: updated
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review
Changed in mahara:
status: Confirmed → In Progress
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Changed priority to 'Medium' as it's not likely that this will happen often that words are entered.

Changed in mahara:
importance: High → Medium
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/13620
Committed: https://git.mahara.org/mahara/mahara/commit/c37d33e817ec9fb0130b155d4ea82f3a5d0ead24
Submitter: "Robert Lyon <email address hidden>"
Branch: main

commit c37d33e817ec9fb0130b155d4ea82f3a5d0ead24
Author: Robert Lyon <email address hidden>
Date: Mon Jan 16 13:44:48 2023 +1300

Bug 2002924: Making sure block count/limit fields have correct rules

They need to be an integer and be between 1 to a sensible higher
number, usually 100

Change-Id: I104ad04f7a4b896986d12cd82ec7a60a90c19a41
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
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.