Follow-up to #2729439: QueryArgsCacheContext should return a special value for ?arg (without value)

Problem/Motivation

Return value could be NULL after #2729439: QueryArgsCacheContext should return a special value for ?arg (without value)

Proposed resolution

Check result of \Symfony\Component\HttpFoundation\Request::getQueryString() and convert it to empty string when NULL

Remaining tasks

User interface changes

API changes

Data model changes

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
StatusFileSize
new1.34 KB
andypost’s picture

StatusFileSize
new2.35 KB

And test+fix

The last submitted patch, 2: 2744421-2-testonly.patch, failed testing.

wim leers’s picture

Title: QueryArgsCacheContext::getContext() should respect interface » QueryArgsCacheContext::getContext() may return NULL, violates the interface
Status: Needs review » Needs work

I'd RTBC this, but the first remark in #2738563-21: Headers cache context does not work, also needs test coverage also applies here. I know it's a pre-existing bit of lack of clarity here, but if we're touching this code, we might as well make the code more legible too.

andypost’s picture

StatusFileSize
new1.08 KB
new2.6 KB

I think this change makes code more readable

andypost’s picture

Status: Needs work » Needs review
andypost’s picture

StatusFileSize
new1.09 KB
new2.6 KB

Proper comments

andypost’s picture

wim leers’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php
@@ -35,13 +38,10 @@ public function getContext($query_arg = NULL) {
+    // No requested argument found.

This comment is wrong. It's also not helpful. Let's remove it.

Once that is fixed, this is RTBC.

The last submitted patch, 9: 2744421-9.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new391 bytes
new2.78 KB

Here's it, bot failures looks unrelated

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

Perfect, thanks!

  • catch committed 63b7ded on 8.2.x
    Issue #2744421 by andypost, Wim Leers: QueryArgsCacheContext::getContext...

  • catch committed 0a27b6c on 8.1.x
    Issue #2744421 by andypost, Wim Leers: QueryArgsCacheContext::getContext...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.2.x and cherry-picked to 8.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.