SMF Development > Bug Reports

HTML-layout error in GenericList.template.php

(1/2) > >>

maestrosite.ru:
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>';
   }

--- End quote ---

2. But end tag have unconditional print (echo without any conditionals)
lines: 139-142:

--- Quote ---   echo '
         </tbody>
         </table>';

--- End quote ---

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];

--- End quote ---

May be add something of this :

--- Quote ---if( empty($context['default_list']) )
   retrun;
if( empty($context[$list_id]) )
   retrun;

--- End quote ---

emanuele:
Hi maestrosite.ru,

thank you for the report.

The first one is for sure a bug.

emanuele:
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?

maestrosite.ru:
Sorry, i dont understabd your thought

emanuele:
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"?

Navigation

[0] Message Index

[#] Next page

Go to full version