Moodle

Preset importer throws error

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.5
  • Fix Version/s: 1.9.1
  • Labels:
    None
  • Environment:
    Current MOODLE_18_STABLE
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

What I wanted to do
============
Import Image gallery preset

What happened
=========
Fatal error: Cannot use string offset as an array in /home/mudrd8mz/public_html/moodle-18-stable/mod/data/lib.php on line 1681

Activity

Hide
Petr Škoda (skodak) added a comment -

hello, could you please try to replicate it in latest 1.9+?
and fix if needed

thanks

Show
Petr Škoda (skodak) added a comment - hello, could you please try to replicate it in latest 1.9+? and fix if needed thanks
Hide
David Mudrak added a comment -

The following code inside the foreach statement fixed the bug in MOODLE_19_STABLE and HEAD:

if (!is_array($value)) { continue; }
Latest 1.9.x is OK then.

It was not backported to 1.8 yet. The patch for MOODLE_18_STABLE is attached in MDL-14466.patch.txt

waiting for +2 approval

Show
David Mudrak added a comment - The following code inside the foreach statement fixed the bug in MOODLE_19_STABLE and HEAD: if (!is_array($value)) { continue; } Latest 1.9.x is OK then. It was not backported to 1.8 yet. The patch for MOODLE_18_STABLE is attached in MDL-14466.patch.txt waiting for +2 approval
Hide
David Mudrak added a comment -

fixed in MOODLE_19_STABLE and HEAD recently. Not backported yet.

Show
David Mudrak added a comment - fixed in MOODLE_19_STABLE and HEAD recently. Not backported yet.
Hide
Petr Škoda (skodak) added a comment -

there are many other bugs in 1.8.x data mod, my +1 to concentrate on 1.9.1

Show
Petr Škoda (skodak) added a comment - there are many other bugs in 1.8.x data mod, my +1 to concentrate on 1.9.1
Hide
Dongsheng Cai added a comment -

Thanks

Show
Dongsheng Cai added a comment - Thanks
Hide
Elvedin Trnjanin added a comment -

This issue also happens in line 1693, so it should say

foreach ($field'#' as $param => $value) {
if (!is_array($value)) { continue; }
$f->$param = $value[0]'#';
}

Show
Elvedin Trnjanin added a comment - This issue also happens in line 1693, so it should say foreach ($field'#' as $param => $value) { if (!is_array($value)) { continue; } $f->$param = $value[0]'#'; }
Hide
Elvedin Trnjanin added a comment -

...for 1.8.5

Show
Elvedin Trnjanin added a comment - ...for 1.8.5

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: