-
Bug
-
Resolution: Fixed
-
Minor
-
2.3.4, 2.4.1, 2.5
-
MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
MDL-37893-grouped-empty -
Difficult
-
Let us have an XML structure like this:
<MOODLE_BACKUP>
|
<COURSE>
|
<FORMATDATA>
|
<WEEKS>
|
<WEEK>
|
<SECTION>1</SECTION>
|
<HIDENUMBER>1</HIDENUMBER>
|
</WEEK>
|
</WEEKS>
|
</FORMATDATA>
|
</COURSE>
|
</MOODLE_BACKUP>
|
Let us parse this XML with our progressive_parser and process it with progressive_parser_processor classes. Let us observe following paths:
$pr->add_path('/MOODLE_BACKUP/COURSE/FORMATDATA', true);
|
$pr->add_path('/MOODLE_BACKUP/COURSE/FORMATDATA/WEEKS/WEEK');
|
As you can see, the FORMATDATA elements was requested to be grouped (the second parameter of the add_path() method). To refresh your backup/restore API knowledge, if a path is processed as a grouped one, it is returned in one chunk together with all its subpaths.
Expected behaviour:
We should get an array like FORMATDATA => WEEKS => WEEK[0], WEEK[1], WEEK[2] etc.
Actual behaviour:
PHP error "array_key_exists() expects parameter 2 to be array, null given" when calling build_currentdata() method's code:
if (!array_key_exists($grouped, $this->currentdata)) {
|
$a = new stdclass();
|
$a->grouped = $grouped;
|
$a->child = $data['path'];
|
throw new progressive_parser_exception('xml_cannot_add_to_grouped', $a);
|
}
|