Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Reproduce:
Create a table without a header with render array:
'limit' => array(
'#theme' => 'table',
'#rows' => $rows,
'#empty' => t('No credit purchases so far.'),
),
Where rows is an empty array.
This will throw error: Warning: Invalid argument supplied for foreach() in theme_table() (line 1676 of .../drupal/includes/theme.inc).
Comment | File | Size | Author |
---|---|---|---|
#18 | header-warning-fix-1183554-18.patch | 907 bytes | diddledani |
#17 | 1183554-table-no-more-errors.png | 30.56 KB | mglaman |
Comments
Comment #1
aspilicious CreditAttribution: aspilicious commentedTotally untested but this could fix it.
Comment #2
aspilicious CreditAttribution: aspilicious commentedMaybe isset needs to be replaced with "count".
Not sure.
Comment #3
blackra CreditAttribution: blackra commented#1: 1183554-header-warning-fix.patch queued for re-testing.
Comment #5
jerdavisRe-roll of patch from #1
Comment #6
BarisW CreditAttribution: BarisW commentedWorks fine. Errors are gone and patch applies nicely.
Comment #7
catchCould we add a test for this?
Comment #8
droplet CreditAttribution: droplet commentedtestbot let's go
Comment #9
BarisW CreditAttribution: BarisW commentedPatch looks good, thanks!
Comment #12
jhedstromComment #13
dimaro CreditAttribution: dimaro commentedRerolled #8
Comment #15
dimaro CreditAttribution: dimaro commentedCurrently this issue doesn't need reroll
Comment #16
penyaskitoTagging per dimaro work.
Comment #17
mglamanThis doesn't look to be an issue in D8 (see below). Also, the patch in #8 looks to be a patch against D7, changing the issue version because it may still exist there.
Header has an empty check
As well as body and footer
Comment #18
diddledaniComment #19
dcam CreditAttribution: dcam commentedThere are tests in #8 that will need to be backported to D7 too.