- Issue created by @_tarik_
- 🇺🇦Ukraine _tarik_ Lutsk
Created PR with the solution from the description
- last update
about 2 years ago 30,307 pass, 2 fail - @_tarik_ opened merge request.
- Status changed to Needs review
about 2 years ago 11:15pm 5 May 2023 - Status changed to Needs work
about 2 years ago 5:00am 6 May 2023 - 🇩🇪Germany a.dmitriiev
This is also an issue when trying to use JSON:API to load field storage configs
/jsonapi/field_storage_config/field_storage_config
- 🇩🇪Germany a.dmitriiev
Uploading patch for 9.5.x made out of MR because it is needed for my project. I want to mention, that this is done not for credit hunting. Please do not give credits and do not use the commit message with me as author.
- 🇧🇬Bulgaria nikolabintev
Patch #9 can be applied to drupal/core (10.0.9) as well. I will test it on 10.1.0 shortly.
- 🇧🇷Brazil fadonascimento
The patch #9 works as expected in Drupal 10.1, this is affect custom entity that use EntityConfig, thanks for the contribution @_tarik_ → .
- Issue was unassigned.
- 🇧🇬Bulgaria pfrenssen Sofia
Interestingly this causes a regression. The fix in the MR will return the full result set, which is the expected behavior according to the documentation:
/** * Defines the range of the query. * * @param int|null $start * (optional) The first record from the result set to return. If NULL, * removes any range directives that are set. * @param int|null $length * (optional) The maximum number of rows to return. If $start and $length * are NULL, then a complete result set will be generated. If $start is * not NULL and $length is NULL, then an empty result set will be * generated. * * @return $this */ public function range($start = NULL, $length = NULL);
However, in the case when
$start
isNULL
, but$length
is set, the current implementation is NOT removing the range directives but is returning the number of results passed in$length
.In this issue we should only fix the deprecation warning but not change the existing behavior (even though it might be wrong). Let's open a separate issue to address the discrepancy between the documentation and the observed behavior.
I will start a new MR with a fix that preserves the existing behavior.
- 🇧🇬Bulgaria pfrenssen Sofia
Created issue to address the discrepancy between the documentation and the existing behavior: 🐛 Omitting $start in entityQuery->range() does not return full result set Active .
- Merge request !6109Deprecation warnings when omitting optional range start in entity queries → (Open) created by pfrenssen
- 🇧🇬Bulgaria pfrenssen Sofia
pfrenssen → changed the visibility of the branch 3358581-deprecated-function-arrayslice to hidden.
- Status changed to Needs review
over 1 year ago 7:41pm 10 January 2024 - 🇧🇬Bulgaria pfrenssen Sofia
Tests have run, they correctly detect the deprecation warning (full test output at https://git.drupalcode.org/issue/drupal-3358581/-/jobs/609008#L5940):
---- Drupal\KernelTests\Core\Entity\ConfigEntityQueryTest ---- Status Group Filename Line Function -------------------------------------------------------------------------------- Fail Other phpunit-370.xml 0 Drupal\KernelTests\Core\Entity\Conf PHPUnit Test failed to complete; Error: PHPUnit 9.6.15 by Sebastian Bergmann and contributors. Testing Drupal\KernelTests\Core\Entity\ConfigEntityQueryTest ........ 8 / 8 (100%) Time: 00:07.274, Memory: 4.00 MB OK (8 tests, 228 assertions) Unsilenced deprecation notices (2) 2x: array_slice(): Passing null to parameter #2 ($offset) of type int is deprecated 2x in ConfigEntityQueryTest::testSortRange from Drupal\KernelTests\Core\Entity
- Status changed to Needs work
over 1 year ago 4:00pm 11 January 2024 - 🇺🇸United States smustgrave
So the proposed solution mentions doing what Select::range() does which is
$this->range = $start !== NULL ? ['start' => $start, 'length' => $length] : [];
But a different solution here. Could it be documented in the issue summary why an alternative was needed.
- Status changed to Needs review
over 1 year ago 8:06pm 11 January 2024 - 🇧🇬Bulgaria pfrenssen Sofia
Updated issue summary. There is a followup issue to address this difference with Select::range(): 🐛 Omitting $start in entityQuery->range() does not return full result set Active .
- Status changed to RTBC
over 1 year ago 10:35pm 11 January 2024 - 🇺🇸United States smustgrave
Thanks for linking that.
Test-only feature shows the coverage and the solution appears correct.
This appears to be a small enough change that I feel comfortable RTBC'ing it.
- Status changed to Fixed
over 1 year ago 6:29pm 12 January 2024 - 🇬🇧United Kingdom longwave UK
Good idea to fix this deprecation here and then decide if we can should fix the method or the docs over in the linked issue.
Backported as a valid bug fix to 10.2.x.
Committed and pushed 8226fe885a to 11.x and 2deae09a5f to 10.2.x. Thanks!
-
longwave →
committed 2deae09a on 10.2.x
Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...
-
longwave →
committed 2deae09a on 10.2.x
-
longwave →
committed 8226fe88 on 11.x
Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...
-
longwave →
committed 8226fe88 on 11.x
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
FYI this introduced a behaviour change to the
::range
method.Previously calling
->range(0, 0)
would return no results, now it returns all results.We found this with a failing test in aggregator module. We suspsect the test is redundant and will likely remove it but wanted to point it out in case someone else came across something similar.
- 🇬🇧United Kingdom longwave UK
Hmm, should we undo this and add test coverage for that? $length of 0 probably should return 0 items?
-
longwave →
committed 3b6f9890 on 10.2.x
Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...
-
longwave →
committed 3b6f9890 on 10.2.x
- Status changed to Needs work
over 1 year ago 9:07am 19 January 2024 -
longwave →
committed 22a493bb on 11.x
Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...
-
longwave →
committed 22a493bb on 11.x
- 🇬🇧United Kingdom longwave UK
Reverted, let's add a test for #28/29 and rework this a bit.
- Merge request !6373Resolve #3358581 "Entity query omit range start fix regression" → (Open) created by pfrenssen
- 🇧🇬Bulgaria pfrenssen Sofia
pfrenssen → changed the visibility of the branch 3358581-entity-query-omit-range-start to hidden.
- Merge request !6374Resolve #3358581 "Entity query omit range start fix regression d11" → (Open) created by pfrenssen
- 🇧🇬Bulgaria pfrenssen Sofia
I updated the patch with a test + fix for the regression reported in #28/29 but I'm having some trouble with the issue fork. The spellcheck job cannot find the 10.2.x branch?
- 🇧🇬Bulgaria pfrenssen Sofia
pfrenssen → changed the visibility of the branch 10.2.x to hidden.
- 🇧🇬Bulgaria pfrenssen Sofia
pfrenssen → changed the visibility of the branch 11.x to hidden.
- Status changed to Needs review
over 1 year ago 5:48pm 29 January 2024 - 🇧🇬Bulgaria pfrenssen Sofia
Manually pushing the 10.2.x and 11.x branches to the issue fork has done the trick. Tests are passing!
- Status changed to Needs work
over 1 year ago 9:09pm 29 January 2024 - 🇺🇸United States smustgrave
Not sure the scenario but could we add a test scenario for NULL, NULL since we doing that check.
- 🇧🇬Bulgaria pfrenssen Sofia
@smustgrave the first test case is doing a (NULL, NULL) check implicitly: https://git.drupalcode.org/project/drupal/-/merge_requests/6374/diffs#95...
- Status changed to Needs review
over 1 year ago 7:10am 30 January 2024 - Status changed to Needs work
over 1 year ago 7:47am 30 January 2024 The Needs Review Queue Bot → tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- Status changed to RTBC
over 1 year ago 1:11pm 30 January 2024 - 🇺🇸United States smustgrave
Not sure what the bot is picking up but the changes in the MR seem fine.
- 🇳🇿New Zealand quietone
I'm triaging RTBC issues → . I read the IS, the comments and the MR. I didn't find any unanswered questions or other work to do.
Leaving at RTBC.
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
Committed and pushed 6227621d38 to 11.x and 418d0cb65c to 10.3.x and 7afb8b2824 to 10.2.x. Thanks!
Backported to 10.2.x as a bug fix. This time without a behaviour change.
- Status changed to Fixed
about 1 year ago 2:10am 29 February 2024 -
alexpott →
committed 7afb8b28 on 10.2.x
Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave, longwave...
-
alexpott →
committed 7afb8b28 on 10.2.x
-
alexpott →
committed 418d0cb6 on 10.3.x
Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave, longwave...
-
alexpott →
committed 418d0cb6 on 10.3.x
-
alexpott →
committed 6227621d on 11.x
Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave, longwave...
-
alexpott →
committed 6227621d on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.