Issue #2729247 by andypost: Replace remaining $request->get() usage to prepare core for Symfony 3
parent
ff28f5250c
commit
240586c0af
|
@ -92,7 +92,7 @@ class FormAjaxSubscriber implements EventSubscriberInterface {
|
||||||
$form_state = $exception->getFormState();
|
$form_state = $exception->getFormState();
|
||||||
|
|
||||||
// Set the build ID from the request as the old build ID on the form.
|
// Set the build ID from the request as the old build ID on the form.
|
||||||
$form['#build_id_old'] = $request->get('form_build_id');
|
$form['#build_id_old'] = $request->request->get('form_build_id');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $this->formAjaxResponseBuilder->buildResponse($request, $form, $form_state, []);
|
$response = $this->formAjaxResponseBuilder->buildResponse($request, $form, $form_state, []);
|
||||||
|
|
|
@ -80,7 +80,7 @@ class NegotiationMiddleware implements HttpKernelInterface {
|
||||||
protected function getContentType(Request $request) {
|
protected function getContentType(Request $request) {
|
||||||
// AJAX iframe uploads need special handling, because they contain a JSON
|
// AJAX iframe uploads need special handling, because they contain a JSON
|
||||||
// response wrapped in <textarea>.
|
// response wrapped in <textarea>.
|
||||||
if ($request->get('ajax_iframe_upload', FALSE)) {
|
if ($request->request->get('ajax_iframe_upload', FALSE)) {
|
||||||
return 'iframeupload';
|
return 'iframeupload';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ class LanguageNegotiationContentEntity extends LanguageNegotiationMethodBase imp
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getLangcode(Request $request = NULL) {
|
public function getLangcode(Request $request = NULL) {
|
||||||
$langcode = $request->get(static::QUERY_PARAMETER);
|
$langcode = $request->query->get(static::QUERY_PARAMETER);
|
||||||
|
|
||||||
$language_enabled = array_key_exists($langcode, $this->languageManager->getLanguages());
|
$language_enabled = array_key_exists($langcode, $this->languageManager->getLanguages());
|
||||||
return $language_enabled ? $langcode : NULL;
|
return $language_enabled ? $langcode : NULL;
|
||||||
|
|
|
@ -79,7 +79,7 @@ class SearchController extends ControllerBase {
|
||||||
// and we don't want to build the results based on last time's request.
|
// and we don't want to build the results based on last time's request.
|
||||||
$build['#cache']['contexts'][] = 'url.query_args:keys';
|
$build['#cache']['contexts'][] = 'url.query_args:keys';
|
||||||
if ($request->query->has('keys')) {
|
if ($request->query->has('keys')) {
|
||||||
$keys = trim($request->get('keys'));
|
$keys = trim($request->query->get('keys'));
|
||||||
$plugin->setSearch($keys, $request->query->all(), $request->attributes->all());
|
$plugin->setSearch($keys, $request->query->all(), $request->attributes->all());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ThemeController extends ControllerBase {
|
||||||
* the token is invalid.
|
* the token is invalid.
|
||||||
*/
|
*/
|
||||||
public function uninstall(Request $request) {
|
public function uninstall(Request $request) {
|
||||||
$theme = $request->get('theme');
|
$theme = $request->query->get('theme');
|
||||||
$config = $this->config('system.theme');
|
$config = $this->config('system.theme');
|
||||||
|
|
||||||
if (isset($theme)) {
|
if (isset($theme)) {
|
||||||
|
@ -102,7 +102,7 @@ class ThemeController extends ControllerBase {
|
||||||
* the token is invalid.
|
* the token is invalid.
|
||||||
*/
|
*/
|
||||||
public function install(Request $request) {
|
public function install(Request $request) {
|
||||||
$theme = $request->get('theme');
|
$theme = $request->query->get('theme');
|
||||||
|
|
||||||
if (isset($theme)) {
|
if (isset($theme)) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -38,9 +38,9 @@ catch (HttpExceptionInterface $e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings::get('rebuild_access', FALSE) ||
|
if (Settings::get('rebuild_access', FALSE) ||
|
||||||
($request->get('token') && $request->get('timestamp') &&
|
($request->query->get('token') && $request->query->get('timestamp') &&
|
||||||
((REQUEST_TIME - $request->get('timestamp')) < 300) &&
|
((REQUEST_TIME - $request->query->get('timestamp')) < 300) &&
|
||||||
Crypt::hashEquals(Crypt::hmacBase64($request->get('timestamp'), Settings::get('hash_salt')), $request->get('token'))
|
Crypt::hashEquals(Crypt::hmacBase64($request->query->get('timestamp'), Settings::get('hash_salt')), $request->query->get('token'))
|
||||||
)) {
|
)) {
|
||||||
// Clear the APCu cache to ensure APCu class loader is reset.
|
// Clear the APCu cache to ensure APCu class loader is reset.
|
||||||
if (function_exists('apcu_clear_cache')) {
|
if (function_exists('apcu_clear_cache')) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ class NegotiationMiddlewareTest extends UnitTestCase {
|
||||||
*/
|
*/
|
||||||
public function testAjaxIframeUpload() {
|
public function testAjaxIframeUpload() {
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$request->attributes->set('ajax_iframe_upload', '1');
|
$request->request->set('ajax_iframe_upload', '1');
|
||||||
|
|
||||||
$this->assertSame('iframeupload', $this->contentNegotiation->getContentType($request));
|
$this->assertSame('iframeupload', $this->contentNegotiation->getContentType($request));
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,11 @@ class NegotiationMiddlewareTest extends UnitTestCase {
|
||||||
$request->setRequestFormat('html')->shouldBeCalled();
|
$request->setRequestFormat('html')->shouldBeCalled();
|
||||||
|
|
||||||
// Some getContentType calls we don't really care about but have to mock.
|
// Some getContentType calls we don't really care about but have to mock.
|
||||||
$request->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
|
$request_data = $this->prophesize(ParameterBag::class);
|
||||||
|
$request_data->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
|
||||||
$request_mock = $request->reveal();
|
$request_mock = $request->reveal();
|
||||||
$request_mock->query = new ParameterBag([]);
|
$request_mock->query = new ParameterBag([]);
|
||||||
|
$request_mock->request = $request_data->reveal();
|
||||||
|
|
||||||
// Calling kernel app with default arguments.
|
// Calling kernel app with default arguments.
|
||||||
$this->app->handle($request_mock, HttpKernelInterface::MASTER_REQUEST, TRUE)
|
$this->app->handle($request_mock, HttpKernelInterface::MASTER_REQUEST, TRUE)
|
||||||
|
@ -126,9 +128,11 @@ class NegotiationMiddlewareTest extends UnitTestCase {
|
||||||
|
|
||||||
// Some calls we don't care about.
|
// Some calls we don't care about.
|
||||||
$request->setRequestFormat('html')->shouldBeCalled();
|
$request->setRequestFormat('html')->shouldBeCalled();
|
||||||
$request->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
|
$request_data = $this->prophesize(ParameterBag::class);
|
||||||
|
$request_data->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
|
||||||
$request_mock = $request->reveal();
|
$request_mock = $request->reveal();
|
||||||
$request_mock->query = new ParameterBag([]);
|
$request_mock->query = new ParameterBag([]);
|
||||||
|
$request_mock->request = $request_data->reveal();
|
||||||
|
|
||||||
// Trigger handle.
|
// Trigger handle.
|
||||||
$this->contentNegotiation->registerFormat('david', 'geeky/david');
|
$this->contentNegotiation->registerFormat('david', 'geeky/david');
|
||||||
|
|
Loading…
Reference in New Issue