Reset configurable theme to default causing warning and loss of styles

Bug #1891425 reported by Lisa Seeto
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Lisa Seeto

Bug Description

It is possible to set a configurable theme for an institution that will itself have a default configuration of pre-set colours. It is possible to configure a new theme, save it and then select "Reset" to return to the default pre-set theme values. Currently, a warning is being produced and Mahara is losing its styling.

To reproduce:
1. Have an institution and log in with an admin member
2. Edit the institution settings and select "Configurable Theme" from the Theme drop-down
3. Set the theme values to any other colour via colour picker or hex value, save
4. The site should update with the newly configured theme, select to edit the institution again
5. return to the Theme settings and set "Reset colours" to "yes", save the page.
Expected result:
The theme is returned to the default configurable theme configuration
Actual result:
All Mahara styling is lost, a warning is produced:

Institution updated successfully. Others will see the new theme the next time they log in.
[WAR] 72 (lib/web.php:90) array_merge(): Argument #2 is not an array
Call stack (most recent first):

    log_message("array_merge(): Argument #2 is not an array", 8, true, true, "/home/lisaseeto/code/mahara-test/htdocs/lib/web.ph...", 90) at /home/lisaseeto/code/mahara-test/htdocs/lib/errors.php:521
    error(2, "array_merge(): Argument #2 is not an array", "/home/lisaseeto/code/mahara-test/htdocs/lib/web.ph...", 90, array(size 11)) at Unknown:0
    array_merge(array(size 2), null) at /home/lisaseeto/code/mahara-test/htdocs/lib/web.php:90
    get_stylesheets_for_current_page(array(size 2), array(size 0)) at /home/lisaseeto/code/mahara-test/htdocs/lib/web.php:646
    smarty(array(size 2)) at /home/lisaseeto/code/mahara-test/htdocs/admin/users/institutions.php:716

Lisa Seeto (lisaseeto)
Changed in mahara:
status: New → In Progress
assignee: nobody → Lisa Seeto (lisaseeto)
description: updated
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/11138

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

Reviewed: https://reviews.mahara.org/11138
Committed: https://git.mahara.org/mahara/mahara/commit/0a579a93c8db7602bf7effb17c7989dc67c2637d
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 0a579a93c8db7602bf7effb17c7989dc67c2637d
Author: Lisa Seeto <email address hidden>
Date: Fri Aug 14 09:47:58 2020 +1200

Bug 1891425: Reset configurable theme to default causing warning and loss of styles

- add check that $sheets can be set to additional_stylesheets before attempting
to merge into array
- fix reset to default config theme values issue

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

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
importance: Undecided → Medium
milestone: none → 21.04.0
milestone: 21.04.0 → 20.10.0
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.