Facet Range Widget throws error when step is set to lower than one

Created on 15 December 2021, almost 3 years ago
Updated 14 February 2024, 9 months ago

Problem/Motivation

Steps to reproduce

Set "slider step" to a 0 < x < 1 decimal number. For example 0.5 or 0.01. This is a big problem when we use price slider and the precision cannot be set to cents or pennies.

The form can be saved but the views page turns out WSOD with this message:

The website encountered an unexpected error. Please try again later.
DivisionByZeroError: Modulo by zero in Drupal\facets_range_widget\Plugin\facets\processor\SliderProcessor->postQuery() (line 56 of modules/contrib/facets/modules/facets_range_widget/src/Plugin/facets/processor/SliderProcessor.php).
Drupal\facets_range_widget\Plugin\facets\processor\SliderProcessor->postQuery() (Line: 196)
Drupal\facets\FacetManager\DefaultFacetManager->processFacets() (Line: 273)
Drupal\facets\FacetManager\DefaultFacetManager->build() (Line: 83)
Drupal\facets\Plugin\Block\FacetBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender()
call_user_func_array() (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 786)
Drupal\Core\Render\Renderer->doCallback() (Line: 377)
Drupal\Core\Render\Renderer->doRender() (Line: 201)
Drupal\Core\Render\Renderer->render() (Line: 157)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 578)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 158)
Drupal\Core\Render\Renderer->renderPlain() (Line: 172)
Drupal\Core\Render\Renderer->renderPlaceholder() (Line: 663)
Drupal\Core\Render\Renderer->replacePlaceholders() (Line: 548)
Drupal\Core\Render\Renderer->doRender() (Line: 201)
Drupal\Core\Render\Renderer->render() (Line: 145)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 578)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 146)
Drupal\Core\Render\Renderer->renderRoot() (Line: 279)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders() (Line: 128)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments() (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond()
call_user_func() (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 191)
Symfony\Component\HttpKernel\HttpKernel->filterResponse() (Line: 179)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 57)
Drupal\Core\StackMiddleware\Session->handle() (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 717)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia kaszarobert

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

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.71.5 2024