- Issue created by @alen simonyan
- @alen-simonyan opened merge request.
- last update
about 1 year ago 30,341 pass - Status changed to Postponed: needs info
about 1 year ago 10:08am 12 December 2023 - π³π±Netherlands Lendude Amsterdam
Thanks for reporting this.
Do you have some steps to reproduce this on a clean Drupal install? Usually this is a symptom of a problem further up and just adding some checks is just hiding the real problem
- π¦π²Armenia alen simonyan
Hi @Lendude,
I diddn't manage to reproduce this on fresh install yet.
- π§πͺBelgium seutje Antwerp
I also ran into this issue. The MR linked above fixed it for 9.x, but failed to apply when I upgraded to 10.x, so I rerolled it, but I changed it to fall back on
$this->options['content']
Unfortunately, I have no clue what the cause is, so I cannot provide any more information... I have a strong suspicion it's being caused by a control module, as I only experience this issue with 1 specific project.
I encountered the same error and implemented a temporary fix, which needs review. The issue arises because $this->options['content'] is expected to be an array but can sometimes be a string.
Hereβs the patch I applied to web/core/modules/views/src/Plugin/views/area/Text.php:
/** * {@inheritdoc} */ public function preQuery() { // Normalize $this->options['content'] to ensure it's an array. if (is_string($this->options['content'])) { // If it's a string, treat it as the content value with a default format. $this->options['content'] = [ 'value' => $this->options['content'], 'format' => filter_default_format(), ]; } // Proceed as normal with the now-normalized content array. $content = $this->options['content']['value']; // Check for tokens that require a total row count. if (str_contains($content, '[view:page-count]') || str_contains($content, '[view:total-rows]')) { $this->view->get_total_rows = TRUE; } }
- π³π±Netherlands Lendude Amsterdam
$this->options['content'] is expected to be an array but can sometimes be a string
@lance lancelot Have you been able to pin down when or why this would be the case? We still need steps to reproduce this on a fresh Drupal install since as it stands currently, the error might just be the correct way to handle this because there is something wrong upstream.
The error occurred after upgrading from Drupal 9 to Drupal 10. To investigate, I exported the configuration files and searched for occurrences of 'content:' strings.
For example, could the following configuration in views.view.comments_recent.yml be causing the error?
label: 'Recent comments' description: 'Recent comments.' display: default: display_title: Default display_options: title: 'Recent comments' fields: changed: settings: future_format: '@interval hence' past_format: '@interval ago' empty: area_text_custom: content: 'No comments available.' # Could this be the source of the problem? block_1: display_title: Block display_options: block_description: 'Recent comments' block_category: 'Lists (Views)'
Iβm not entirely sure, but could the content: 'No comments available.' string format be causing the issue? Should it now be structured as:
content: value: 'No comments available.' format: 'plain_text'
Is this new format required in Drupal 10, and if so, was this change documented? Iβd appreciate any clarification or guidance regarding this.
- π©πͺGermany alxn
I just encountered this issue with Drupal 10.3.10 and Workbench 1.6 and can confirm that the error is resolved after changing the content structure in the relevant configuration to:
content: value: '<h3>Example</h3>' format: 'basic_html'
I noticed that the following warning was issued during the configuration import with the structured content:
[warning] Array to string conversion StatementWrapperIterator.php:113