Closed (won't fix)
Project:
Matrix field
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Oct 2011 at 14:54 UTC
Updated:
4 Sep 2012 at 07:49 UTC
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
Comment #1
intrafusion