Deprecated function: array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated in Drupal\Core\Config\Entity\Query\Query->execute()

Created on 5 May 2023, about 1 year ago
Updated 14 March 2024, 4 months ago

Problem/Motivation

The range() method of class QueryBase, namespace Drupal\Core\Entity\Query should reset the range property if the method is called without parameters. But instead, the function sets NULLs for array values in the property range.

It produces a warning message:

Deprecated function: array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated in Drupal\Core\Config\Entity\Query\Query->execute() (line 107 of /var/www/html/core/lib/Drupal/Core/Config/Entity/Query/Query.php)

Steps to reproduce

Try to load any config entities with the range() method without parameters.
Ex:
\Drupal::entityQuery('field_storage_config')->range()->execute();

Proposed solution

Fix the deprecation warning without altering existing behavior, to prevent regressions.

🐛 Bug report
Status

Fixed

Version

10.2

Component
Configuration entity 

Last updated about 2 hours ago

Created by

🇺🇦Ukraine _tarik_ Lutsk

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

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