Here is the web/core/modules/views/src/Plugin/views/PluginBase.php::viewsTokenReplace() function:

  protected function viewsTokenReplace($text, $tokens) {
    if (!strlen($text)) {
      // No need to run filterAdmin on an empty string.
      return '';
    }
     ....

The !strlen($text) check is made to check if $text is empty or null
This is deprecated in php 8.1

maybe we can replace by:

  protected function viewsTokenReplace($text, $tokens) {
    if (!$text) {
      // No need to run filterAdmin on an empty string.
      return '';
    }
     ....
CommentFileSizeAuthor
#9 3344026-9.patch579 bytesodai jbr

Issue fork drupal-3344026

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DuneBL created an issue. See original summary.

cilefen’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

There must be missing automated test coverage. How do you reproduce the bug?

dunebl’s picture

The bug can be reproduced by embedding a view in a preprocess function like the following:

  $view = Views::getView('all_inv');
  $view->setDisplay('e_invs_of_tsc');
  $view->preExecute([$company->id()]);
  $view->execute();
  $variables['content']['field_tsc_investments'] = $view->buildRenderable('e_invs_of_tsc');

ok, when looking at this old code, I know that I could use views_embed_view('all_inv','e_invs_of_tsc',$company->id())

cilefen’s picture

Do you have the time to contribute a failing unit test inside the views module?

dunebl’s picture

Sorry I don't know how to handle a test unit... and I am overbooked at 150% until may

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Needs work

Appears there was a scenario in #3

davemaxg’s picture

I believe this also happens when a field is added to an entity after entities already exist. In this case, these fields wouldn't exist in the database and would be nulls and would trigger the same error. This is happening to me on 10.2.2

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

odai jbr’s picture

StatusFileSize
new579 bytes

This patch solves the issue for version 9.5.11

samitk’s picture

Assigned: Unassigned » samitk

samitk’s picture

Assigned: samitk » Unassigned
Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work

The Needs Review Queue Bot tested this issue.

While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

samitk’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

The issue summary is incomplete.

Research needs to be done to why that’s empty. Just putting a check isn’t enough.

joao.ramos.costa’s picture

The very same issue happened to me when language configuration override contains data that differs from the expected type.
In this case https://www.drupal.org/project/tmgmt/issues/3509121.

Can be related with this line, for instance: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/confi...

If a given config entry value isn't passed it will be set as null, despite it's base config expected value/schema ?

Cheers.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.