Problem/Motivation

In \Drupal\Core\Config\Entity\Query\Condition we process $condition['value'] when it is NULL. This results in deprecation errors in PHP 8.1 because we pass NULLs to functions that only support strings.

Proposed resolution

Don't call this code for 'NULL' values

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

N/a

CommentFileSizeAuthor
#10 3301613-10.diff774 bytesj_s

Issue fork drupal-3301613

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

froboy created an issue. See original summary.

froboy’s picture

I've seen this with the following condition:

array (
  'field' => 'uuid',
  'value' => NULL,
  'operator' => '=',
  'langcode' => NULL,
)

which seems to be coming from a custom migration attempting to be imported by `config_devel`. The warning thrown is:

Deprecated function: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Core\Config\Entity\Query\Condition->compile() (line 39 of core/lib/Drupal/Core/Config/Entity/Query/Condition.php).

It's possible that something is broken upstream, but looking at the logic here it still seems like we should prevent a NULL value from being processed.

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

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.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, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

j_s’s picture

The change in MR!2585 fixes the error for me. Thanks!

socialnicheguru’s picture

Status: Active » Needs work

if you goto /admin/module
enable a module with dependencies
when you click on the button the first time it will show you the dependencies
on that page is a button to install
when you click on it, you are taken to the admin/module page and nothing has happened. no modules were enabled

kolesnikoff’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Per #7

Also will probably need a test case to cover this change.

j_s’s picture

StatusFileSize
new774 bytes

Attached static diff from the current MR!2585.

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.