Download & Extend

theme_item_list function duplicates last $data value when dealing with children

Project:Drupal core
Version:6.x-dev
Component:theme system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:needs backport to D6, needs backport to D7, Needs issue summary update, Needs tests

Issue Summary

When you want to print multi-level lists with item_list theme, there is a configuration where the $data variable is not reset. This create duplicates in the rendered list.

Example:

$items = array(
  array(
    'children' => array('item 1', 'item 2'),
  ),
  array(
    'children' => array('item 3', 'item 4'),
  ),
);
theme('item_list', $items);

The result is:

    • item 1
    • item 2
    • item 1
    • item 2
    • item 3
    • item 4
AttachmentSizeStatusTest resultOperations
drupal_theme_item_list.patch544 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Invalid patch format in drupal_theme_item_list.patch.View details | Re-test

Comments

#1

Status:needs review» needs work

The last submitted patch, drupal_theme_item_list.patch, failed testing.

#2

AttachmentSizeStatusTest resultOperations
drupal_theme_item_list.patch528 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_theme_item_list_0.patch.View details | Re-test

#3

Status:needs work» needs review

#4

Status:needs review» needs work

The last submitted patch, drupal_theme_item_list.patch, failed testing.

#5

Status:needs work» needs review
AttachmentSizeStatusTest resultOperations
drupal_theme_item_list.patch510 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_theme_item_list_1.patch.View details | Re-test

#6

Sorry, it was not the right patch...

AttachmentSizeStatusTest resultOperations
drupal_theme_item_list.patch546 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_theme_item_list_2.patch.View details | Re-test

#7

Status:needs review» needs work

The last submitted patch, drupal_theme_item_list.patch, failed testing.

#8

Try again :)

AttachmentSizeStatusTest resultOperations
drupal_theme_item_list.patch555 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal_theme_item_list_3.patch.View details | Re-test

#9

Status:needs work» needs review

#10

Status:needs review» needs work

The last submitted patch, drupal_theme_item_list.patch, failed testing.

#11

Version:6.16» 7.x-dev
Status:needs work» needs review

D7 still has this bug.

AttachmentSizeStatusTest resultOperations
774040-duplicate-data-with-children-element-11-D7.patch782 bytesIgnored: Check issue status.NoneNone

#12

Remove the tag put in by mistake

#13

Version:7.x-dev» 8.x-dev

Needs to be fixed in D8 first before D7 and D6 patches will even be considered.

This simple one line initializing the $data value looks good to me, but I do not have a testing environment to test the patch.

#14

Updating the issue tags so flagged for backporting to D7 and D6.

#15

Status:needs review» reviewed & tested by the community

This fixes the bug described in the OP, as well as a PHP notice when $data isn't present.

#16

Tagging issues not yet using summary template.

#17

Status:reviewed & tested by the community» needs work
Issue tags:+Needs tests

Sorry, but we need tests here.

Though this patch also somewhat duplicates the work in #256827: Various bugs in theme_item_list()

#18

Version:8.x-dev» 6.x-dev

This was apparently committed already in D7 and obsolete in D8.

http://drupalcode.org/project/drupal.git/commit/781b8961