Skip to content

Why is there a rawurldecode() done on the request URI? #66

@7ochem

Description

@7ochem

See

$publicUrl = rawurldecode($request->getRequestUri());

And there is also a test testing this:

public function testParameterParsingUtf8()
{
$event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')
->disableOriginalConstructor()
->getMock()
;
$request = new Request();
$uri = '/%D0%9F%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%86%D0%B8%D1%8F-%D1%84%D0%B8%D1%80%D0%BC%D1%8B-%E2%80%9C%D0%9C%D0%BE%D0%BA%D0%B2%D0%B5%D0%BB%D0%B4%E2%80%9D/products';
$internal = '/ru/products/1';
$request->server->set('REQUEST_URI', $uri);
$this->listener->setIsParamsEnabled(true);
$event->expects($this->any())->method('getRequest')->will($this->returnValue($request));
$event->expects($this->any())->method('getRequestType')->will($this->returnValue(HttpKernelInterface::MASTER_REQUEST));
$event->expects($this->any())->method('getKernel')->will($this->returnValue($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel')->disableOriginalConstructor()->getMock()));
$this->aliasing->expects($this->any())->method('hasInternalAlias')->willReturnCallback(function($uri) use($internal) {
if ($uri === '/Продукция-фирмы-“Моквелд”/products') {
return new UrlAlias('/Продукция-фирмы-“Моквелд”/products', $internal, 0);
}
return null;
});
$this->listener->onKernelRequest($event);
$this->assertSame($uri, $request->server->get('ORIGINAL_REQUEST_URI'));
$this->assertSame($internal, $request->server->get('REQUEST_URI'));
}

(committed here 5abb23f)

This causes issues when having a URL like /path?xyz=%3Fabc%3D123 which is then decoded into /path?xyz=?abc=123

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions