Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In setRequest() we have:
public function setRequest(Request $request) {
// Pre-calculate and store values based on the request that may be used
// repeatedly in generate().
$this->active = array(
'route_name' => $request->attributes->get(RouteObjectInterface::ROUTE_NAME),
'language' => $this->languageManager->getLanguage(Language::TYPE_URL)->id,
'parameters' => (array) $request->attributes->get('_raw_variables') + (array) $request->query->all(),
);
}
This later comparison to the parameters don't work since $request->attributes->get('_raw_variables') is actually a ParamterBag object, not an array, and when it's not NULL we get an extra nested array from the cast.
Comment | File | Size | Author |
---|---|---|---|
#5 | test-and-fix-2084125-5.patch | 4.86 KB | pwolanin |
#5 | 2084125-3-5.increment.txt | 1.25 KB | pwolanin |
#3 | test-only-2084125-3-FAIL.patch | 3.83 KB | pwolanin |
#3 | test-and-fix-2084125-3-PASS.patch | 4.89 KB | pwolanin |
#2 | 2084125-1.patch | 1.06 KB | pwolanin |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedThis simple fix should do it, but we should make sure there's a test in core that covers this properly.
Comment #2
pwolanin CreditAttribution: pwolanin commentedComment #3
pwolanin CreditAttribution: pwolanin commentedHere's a change to the unit test to demonstrate the failure, and a combined patch.
Comment #4
dawehnerI remember when we wrote that, the issue about removing active was really active ... luckily we are still in php world.
These two variables are not used at all, so let's remove it.
Comment #5
pwolanin CreditAttribution: pwolanin commentedok, sure.
Comment #6
pwolanin CreditAttribution: pwolanin commentedhas tests now
Comment #7
dawehnerThank you
Comment #8
dawehnerNote: we should try to split up all the different cases in the active test method into multiple tests. This potentially is easier to read when we choose descriptive function names, but this is out of scope of this issue.
Comment #9
catchCommitted/pushed to 8.x, thanks!