Skip to content

Commit 22a493b

Browse files
committed
Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave: Deprecated function: array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated in Drupal\Core\Config\Entity\Query\Query->execute()"
This reverts commit 8226fe8.
1 parent 5d70bf4 commit 22a493b

2 files changed

Lines changed: 3 additions & 24 deletions

File tree

core/lib/Drupal/Core/Entity/Query/QueryBase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ public function notExists($property, $langcode = NULL) {
193193
* {@inheritdoc}
194194
*/
195195
public function range($start = NULL, $length = NULL) {
196-
$this->range = $start || $length ? [
197-
'start' => $start ?? 0,
196+
$this->range = [
197+
'start' => $start,
198198
'length' => $length,
199-
] : [];
199+
];
200200
return $this;
201201
}
202202

core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -499,27 +499,6 @@ public function testSortRange() {
499499
->execute();
500500
$this->assertSame(['1', '2', '3'], array_values($this->queryResults));
501501

502-
// Omit optional parameters for the range and sort.
503-
$this->queryResults = $this->entityStorage->getQuery()
504-
->range()
505-
->sort('id')
506-
->execute();
507-
$this->assertSame(['1', '2', '3', '4', '5', '6', '7'], array_values($this->queryResults));
508-
509-
// Omit the optional start parameter for the range.
510-
$this->queryResults = $this->entityStorage->getQuery()
511-
->range(NULL, 1)
512-
->sort('id')
513-
->execute();
514-
$this->assertSame(['1'], array_values($this->queryResults));
515-
516-
// Omit the optional length parameter for the range.
517-
$this->queryResults = $this->entityStorage->getQuery()
518-
->range(4)
519-
->sort('id')
520-
->execute();
521-
$this->assertSame(['5', '6', '7'], array_values($this->queryResults));
522-
523502
// Apply a pager with limit 4.
524503
$this->queryResults = $this->entityStorage->getQuery()
525504
->pager('4', 0)

0 commit comments

Comments
 (0)