JsonException when sizes['#text'] is empty

Created on 20 June 2023, over 1 year ago
Updated 21 June 2023, over 1 year ago

Problem/Motivation

json_encode expect a non-empty string as the first parameter. We should verify that all text passed to json_encode is valid json.

Example error in ResponsiveImageStylesTwigExtension line 79:

JsonException: Syntax error in json_decode() (line 79 of modules/contrib/pagedesigner_responsive_images/src/ResponsiveImageStylesTwigExtension.php).
Drupal\pagedesigner_responsive_images\ResponsiveImageStylesTwigExtension->getImageStyles() (Line: 70)
__TwigTemplate_8f74970056ce4280fe6531e6c8ed6283->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 85)
__TwigTemplate_2419b483df3b943f628de4d90fe6130d->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 390)
Twig\Template->render() (Line: 55)
twig_render_template() (Line: 384)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 446)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 42)
__TwigTemplate_6a5f95dc5741cf54f5725ce069088987->doDisplay() (Line: 405)
🐛 Bug report
Status

Fixed

Version

2.2

Component

Code

Created by

🇨🇭Switzerland pvbergen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024