Warning produced when adding/ editing an image gallery block

Bug #1855023 reported by Lisa Seeto on 2019-12-04
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Status tracked in 20.04
19.10
High
Unassigned
20.04
High
Lisa Seeto

Bug Description

A warning message is being produced when adding or editing an image gallery block (see attached screenshot)

To reproduce:
1) Log in as any user and create a page
2) Edit the page and select image gallery block, select some images, press save
expected results:
The page displays with an image gallery and no warnings
actual results:
The page displays with an image gallery and warnings:
"[WAR] 98 (blocktype/lib.php:2104) stripos() expects parameter 1 to be string, array given"

This issue is occurring because the javascript function get_get_javascript_javascript($jsfiles) in blocktype/lib.php has been set up to expect a non-empty file entry in its logic in its foreach loop. This is an issue in artefact/file/blocktype/gallery/lib.php in get_instance_javascript() which passes down an array with an empty file entry:

            array(
                'file' => '',
                'initjs' => "$('#slideshow{$blockid}').on('slid.bs.carousel', function () {
                    $(window).trigger('colresize');
                });"
            )
The get_get_javascript_javascript($jsfiles) should be amended to handle the above input.

Version: 20.04dev

Robert Lyon (robertl-9) on 2019-12-08
Changed in mahara:
assignee: nobody → Lisa Seeto (lisaseeto)
Lisa Seeto (lisaseeto) on 2019-12-08
Changed in mahara:
status: New → In Progress
Mahara Bot (dev-mahara) wrote :

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

Reviewed: https://reviews.mahara.org/10658
Committed: https://git.mahara.org/mahara/mahara/commit/a5012e5cdc22dc91770616e68f1b089157579b41
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: master

commit a5012e5cdc22dc91770616e68f1b089157579b41
Author: Lisa Seeto <email address hidden>
Date: Mon Dec 9 11:28:09 2019 +1300

Bug 1855023: Warning produced when adding/ editing an image gallery block

- changed for loop in get_get_javascript_javascript func to continue
when encountering empty filename vars.

behatnotneeded

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

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10675
Committed: https://git.mahara.org/mahara/mahara/commit/a3aa7b0acbbb77517ee148ec726a45bdbe52b9a4
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: 19.10_STABLE

commit a3aa7b0acbbb77517ee148ec726a45bdbe52b9a4
Author: Lisa Seeto <email address hidden>
Date: Mon Dec 9 11:28:09 2019 +1300

Bug 1855023: Warning produced when adding/ editing an image gallery block

- changed for loop in get_get_javascript_javascript func to continue
when encountering empty filename vars.

behatnotneeded

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers