Zend Framework

HtmlList doesn't pass on the escape parameter for sub lists

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.0
  • Fix Version/s: 1.5.2
  • Component/s: Zend_View
  • Labels:
    None
  • Fix Version Priority:
    Must Have

Description

The HtmlList helper accepts an 'escape' parameter to determine whether or not to escape given list before rendering. But when it recursively calls itself to render sub lists, it doesn't pass on the escape parameter so sub lists are always escaped.

Issue Links

Activity

Hide
Martin Hujer added a comment -

Duplicity of ZF-2527

Show
Martin Hujer added a comment - Duplicity of ZF-2527
Hide
Martin Hujer added a comment -

It is already fixed in 1.5.0RC3 and in trunk.

Show
Martin Hujer added a comment - It is already fixed in 1.5.0RC3 and in trunk.
Hide
Martin Hujer added a comment -

Sorry, it was a mistake, I got confused with ZF-2527.

This is not fixed.

The code between 58-69 need some comments, It is not 100%-ly clean; especially:

if (5 < strlen($list)) {

58:        foreach ($items as $item) {
            if (!is_array($item)) {
                if ($escape) $item = $this->view->escape($item); 
                $list .= '<li>' . $item . '</li>';
            } else {
                if (5 < strlen($list)) {
                    $list = substr($list, 0, strlen($list) - 5) . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>';
                } else {
                    $list .= '<li>' . $this->htmlList($item, $ordered) . '</li>';
                }
            }
        }
Show
Martin Hujer added a comment - Sorry, it was a mistake, I got confused with ZF-2527. This is not fixed. The code between 58-69 need some comments, It is not 100%-ly clean; especially:
if (5 < strlen($list)) {
58:        foreach ($items as $item) {
            if (!is_array($item)) {
                if ($escape) $item = $this->view->escape($item); 
                $list .= '<li>' . $item . '</li>';
            } else {
                if (5 < strlen($list)) {
                    $list = substr($list, 0, strlen($list) - 5) . $this->htmlList($item, $ordered, $attribs, $escape) . '</li>';
                } else {
                    $list .= '<li>' . $this->htmlList($item, $ordered) . '</li>';
                }
            }
        }
Hide
Martin Hujer added a comment -

It is related, but doesn't duplicate it.

Show
Martin Hujer added a comment - It is related, but doesn't duplicate it.
Hide
Harro van der Klauw added a comment -

The Unit test for this item fails to notice this bug because all the item arrays build there all start with a single value, the issue only occurs when the first item in the array is also an array.

Issue ZF-2527 has a diff attached that did properly fix the problem.
Line 66 needs to have the attribs and escape added.

Show
Harro van der Klauw added a comment - The Unit test for this item fails to notice this bug because all the item arrays build there all start with a single value, the issue only occurs when the first item in the array is also an array. Issue ZF-2527 has a diff attached that did properly fix the problem. Line 66 needs to have the attribs and escape added.
Hide
Wil Sinclair added a comment -

Please categorize/fix as needed.

Show
Wil Sinclair added a comment - Please categorize/fix as needed.
Hide
Wil Sinclair added a comment -

Resetting 'fix version priority' and 'fix version' to be re-evaluated for next release.

Show
Wil Sinclair added a comment - Resetting 'fix version priority' and 'fix version' to be re-evaluated for next release.
Hide
Matthew Weier O'Phinney added a comment -

Scheduling for next mini release.

Show
Matthew Weier O'Phinney added a comment - Scheduling for next mini release.
Hide
Matthew Weier O'Phinney added a comment -

Resolved in trunk and 1.5 release branch

Show
Matthew Weier O'Phinney added a comment - Resolved in trunk and 1.5 release branch

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
5m
Original Estimate - 5 minutes
Remaining:
5m
Remaining Estimate - 5 minutes
Logged:
Not Specified
Time Spent - Not Specified