Hello,

In theme_matrix_formatter_default count is called on $data on each iteration but $data is also modified on each iteration. Sometimes when there are more headers than columns $data count is incremented on each iteration leading to an infinite loop.

Incorrect code is :

$row_count = count($data[0]);
    if ($row_count < count($header)) {
      for($i = $row_count; $i < count($header); $i++) {
        for ($j = 0; $j < count($data); $j++) {
          $data[$j][$i] = '-';
        }
      }
    }

My fix proposal :

$data_count = count($data); 
    $row_count = count($data[0]);
    if ($row_count < count($header)) {
      for($i = $row_count; $i < count($header); $i++) {
        for ($j = 0; $j < $data_count; $j++) {
          $data[$j][$i] = '-';
        }
      }
    }

Regards,

Wanjee

Comments

intrafusion’s picture

Status: Active » Closed (won't fix)