Skip to content

Commit 5a97b97

Browse files
committed
Remove injecting query parameters and POST parameters in controllers as it's risky and can break an application easily (if users pass any query/post parameter they want)
1 parent cbfa107 commit 5a97b97

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

src/Controller/ControllerResolver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getController(Request $request)
3636
$parameters = [
3737
'request' => $request,
3838
];
39-
$parameters += $request->attributes->all() + $request->request->all() + $request->query->all();
39+
$parameters += $request->attributes->all();
4040

4141
return $this->invoker->call($controller, $parameters);
4242
};

tests/FunctionalTest.php

-28
Original file line numberDiff line numberDiff line change
@@ -62,34 +62,6 @@ public function should_pass_url_placeholders()
6262
$this->assertEquals('Hello john', $response->getContent());
6363
}
6464

65-
/**
66-
* @test
67-
*/
68-
public function should_pass_query_parameters()
69-
{
70-
$app = $this->createApplication();
71-
72-
$app->get('/', ['DI\Bridge\Silex\Test\Fixture\Controller', 'hello']);
73-
74-
$response = $app->handle(Request::create('/?name=john'));
75-
$this->assertEquals('Hello john', $response->getContent());
76-
}
77-
78-
/**
79-
* @test
80-
*/
81-
public function should_pass_post_data()
82-
{
83-
$app = $this->createApplication();
84-
85-
$app->post('/', ['DI\Bridge\Silex\Test\Fixture\Controller', 'hello']);
86-
87-
$response = $app->handle(Request::create('/', 'POST', [
88-
'name' => 'john',
89-
]));
90-
$this->assertEquals('Hello john', $response->getContent());
91-
}
92-
9365
/**
9466
* @test
9567
*/

0 commit comments

Comments
 (0)