Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
request processing system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Oct 2021 at 11:08 UTC
Updated:
22 Oct 2021 at 12:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
alexpottBefore
After
Comment #3
andypostFound this while digging issue https://symfony.com/blog/new-in-symfony-5-1-simpler-request-context
The failure is because
\Symfony\Component\Routing\RequestContext::setMethod()makesstrtoupper()also the method expects non-nullable string in SF 4/5/6 https://github.com/symfony/symfony/blob/6.0/src/Symfony/Component/Routin...I find better to prevent passing
NULLas it's not supposed by\Symfony\Component\Routing\RequestContext::getMethod()and expect the defaultNULLas default string.@alexpott I wondered why next
$this->assertEquals($method, $requestContext->getMethod());compares NULL with '' without notices on 8.1rc3Comment #4
andypostproper component
Comment #5
andypost@alexpott This code comments to NULL and FALSE been added #2901572: Fix 'Drupal.Commenting.PostStatementComment' coding standard but test values exists since #2822190-40: PathValidator validates based on a RequestContext leaked from the current request, resulting in false negatives during CLI requests and POST submissions you, @WimLeers @catch recalls...
Comment #6
andypostThe test added by @WIm Leers #2822190-40: PathValidator validates based on a RequestContext leaked from the current request, resulting in false negatives during CLI requests and POST submissions
Comment #7
andypostComment #8
andypostI think this was missed in initial test implementation
Comment #9
alexpott@andypost all #8 is test $method being equal to a string twice. Yes at some point the FALSE is going to produce a deprecation but atm it does not.
Let's go back to #2 and deal with the FALSE when and if a deprecation occurs for that.
Comment #10
alexpott$this->assertEquals($method, $requestContext->getMethod());we be true without notices when the values are 0, '', NULL, FALSE ... it's assertEquals and not assertSameComment #11
alexpottAs stated in the issue summary
because of the strtoupper() and the way \Symfony\Component\Routing\RequestContext() works.
Comment #12
daffie commentedWhy are we doing this change instead of
$requestContext = \Drupal::service('router.request_context');?Is this change really necessary? If so, can we then remove the first line of this test with:
$requestContext = \Drupal::service('router.request_context');. That variable is not used anywhere.Comment #13
alexpott@daffie I think you reviewed #8 and not #9.
Comment #14
alexpottComment #15
daffie commented@alexpott: Yes ,you are right. I reviewed the wrong patch.
The patch from #9 looks good to me.
Comment #17
catchCommitted 397d199 and pushed to 9.3.x. Thanks!
Comment #18
catch