Moodle

Void vars in block processing (Notice end warning on main page)

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.8.3
  • Fix Version/s: None
  • Component/s: Blocks
  • Labels:
    None
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE

Description

Sometime in first or course pages presents Notice and Warnings from blocklib.php file.
The function block_have_content () works notcorrectly with the pointer:
operator
$instance = &$pageblocks[$position][$n];
this is tantamount of
$instance = null;
$pageblocks[$position][$n] = &$instance;

if iteracion breacked, in array present non-object var.

Befor $instance = &$pageblocks[$position][$n]; need adds:
if (!isset($pageblocks[$position][$n])) {continue;}
or other restructured of code.

Activity

Hide
Elvedin Trnjanin added a comment -

Still exists in 1.8.5+

It's mostly an annoyance in the logs as some blog returned NULL for us. The fix could change little with the check of !isset($instance->visible)

for ($n=0; $n<count($pageblocks[$position]);$n++) {
$instance = &$pageblocks[$position][$n];
if(!isset($instance->visible) || !$instance->visible) { continue; }

Show
Elvedin Trnjanin added a comment - Still exists in 1.8.5+ It's mostly an annoyance in the logs as some blog returned NULL for us. The fix could change little with the check of !isset($instance->visible) for ($n=0; $n<count($pageblocks[$position]);$n++) { $instance = &$pageblocks[$position][$n]; if(!isset($instance->visible) || !$instance->visible) { continue; }

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated: