Incorrect uc_cart block delta causes skipping of uc_cart_preprocess_block

Created on 23 November 2022, over 1 year ago
Updated 30 October 2023, 8 months ago

Problem/Motivation

In the uc_cart_preprocess_block() there is a code:

if ($variables['block']->module == 'uc_cart' && $variables['block']->delta == 0 && $variables['block']->subject) {
  ...
}

Code is checking for the $variables['block']->delta and comparing with zero. However the correct delta for the uc_cart block is cart, see:

  $blocks['cart'] = array(
    'info' => t('Shopping cart'),
    'cache' => DRUPAL_NO_CACHE,
    'pages' => 'admin*',
  );

The condition evaluates to TRUE on PHP 7.x and lower, but on PHP 8, the comparission with zero is FALSE and therefore the block is not themed correctly.

Steps to reproduce

Enable uc_cart block on PHP 7.x and PHP 8.1 and compare its HTML markup.

Proposed resolution

Fix the delta to the correct value.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Cart/checkout

Created by

πŸ‡ΈπŸ‡°Slovakia poker10

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024