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.
The situation, the bug
This code in "uc_cart.module" produce an error with file "uc_cart_checkout_review.tpl.php".
function uc_cart_theme() {
...
'uc_cart_checkout_review' => array(
'arguments' => array('help' => NULL, 'panes' => NULL, 'form' => NULL),
'file' => 'uc_cart.pages.inc',
),
...
$panes is not available for the foreach
foreach ($panes as $title => $data) {
$output .= '<tr class="pane-title-row"><td colspan="2">'. $title
in template file.
Quick fix for this bug
This code produce no error:
function uc_cart_theme() {
...
'uc_cart_checkout_review' => array(
'arguments' => array('panes' => NULL, 'form' => NULL),
'file' => 'uc_cart.pages.inc',
),
...
with template file "uc_cart_checkout_review.tpl.php".
Comment | File | Size | Author |
---|---|---|---|
#5 | ubercart-497872-5.patch | 515 bytes | cedarm |
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedSo... I don't understand why you also dropped $help or what exactly it is you're trying to do. : ?
Comment #2
quiptime CreditAttribution: quiptime commentedThe variable $help produce an error in the file "uc_cart_checkout_review.tpl.php".
The error message is:
warning: Invalid argument supplied for foreach() in /.../sites/all/themes/.../uc_cart_checkout_review.tpl.php on line 12.
The line 12 is:
This is the part of the function uc_cart_theme() call the theme function:
This is the first line of the theme function theme_uc_cart_checkout_review():
The parameter variable $help no exist in this function. This produce the error in the template file.
Without the variable $help in the function uc_cart_theme() no error with "uc_cart_checkout_review.tpl.php".
Comment #3
rszrama CreditAttribution: rszrama commentedOk, so I'm not really sure what you're pointing out as a bug. Is it that we should be defaulting panes to array() instead of NULL in that hook_theme() implementation and removing the $title variable from it?
Comment #4
rszrama CreditAttribution: rszrama commentedComment #5
cedarm CreditAttribution: cedarm commentedThe theme function is defined as
function theme_uc_cart_checkout_review($panes, $form) {
and appears to only be called from uc_cart_checkout_review()
$output = theme('uc_cart_checkout_review', $data, $form);
where $data is pane information. I can't reproduce the warning, but shouldn't hook_theme be changed to match?
Looks to me like removing help is the appropriate change.
Comment #6
Island Usurper CreditAttribution: Island Usurper commentedSo, yes, it's a bug to declare that theme_uc_cart_checkout_review() takes three parameters when it only takes two. However, symptoms don't appear until someone alters the theme registry to use a template file instead of the theme function. I think it's worth fixing.
Committed patch.