Where the Error Occurred
File: GenericList.template.php
Line: 86-110,
Any relevant errors in the SMF error log (if so please post them)?:
1. Start tag for tbody-element print in if-section.
lines: 86-110
Quote
if (!($header_count < 2 && empty($cur_list['headers'][0]['label'])))
{
echo '
<thead>
<tr class="catbg">';
...
echo '
</tr>
</thead>
<tbody>';
}
2. But end tag have unconditional print (echo without any conditionals)
lines: 139-142:
Quote
echo '
</tbody>
</table>';
Total: if current list have not headers then result layout not valid - missing <tbody>.
Additionally for this function.
Don`t check existing of current list:
lines:17-19
Quote
// Get a shortcut to the current list.
$list_id = $list_id === null ? $context['default_list'] : $list_id;
$cur_list = &$context[$list_id];
May be add something of this :
Quote
if( empty($context['default_list']) )
retrun;
if( empty($context[$list_id]) )
retrun;
Hi maestrosite.ru,
thank you for the report.
The first one is for sure a bug.
The second is an assumption in the code (i.e. the code assume the list exists)...maybe some kind of warning if it doesn't?
Sorry, i dont understabd your thought
Sorry, I was thinking to another issue and the sentence is not very clear.
I mean that the current code does an assumption: the list exists.
And I agree it's not correct, at least it's not in line with (most of) the other the code in SMF.
What I'm wondering is: is it better to just "return;" or maybe create a sort of error like: "the list doesn't exist"?
Of course, better is show error! I'm wrote code only for example.
(And I think best - throw Exception, but is not SMF-way)
The first was fixed in 2.1 some time ago, the second I've just changed in 2.1 to not throw an error (throwing an error of any kind from the template itself would be a bit awkward and inconsistent)