diff --git a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php index f4b4506..8f1cf3e 100644 --- a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionSubscriber.php @@ -172,7 +172,7 @@ protected function onJson(GetResponseForExceptionEvent $event) { // Display the message if the current error reporting level allows this type // of message to be displayed, - $data = []; + $data = NULL; if (error_displayable($error) && $message = $exception->getMessage()) { $data = [sprintf('A fatal error occurred: %s', $message)]; } diff --git a/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php index 5f13978..7befb00 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php @@ -39,7 +39,7 @@ protected static function getPriority() { * The event to process. */ public function on403(GetResponseForExceptionEvent $event) { - $response = new JsonResponse([], Response::HTTP_FORBIDDEN); + $response = new JsonResponse(NULL, Response::HTTP_FORBIDDEN); $event->setResponse($response); } @@ -50,7 +50,7 @@ public function on403(GetResponseForExceptionEvent $event) { * The event to process. */ public function on404(GetResponseForExceptionEvent $event) { - $response = new JsonResponse([], Response::HTTP_NOT_FOUND); + $response = new JsonResponse(NULL, Response::HTTP_NOT_FOUND); $event->setResponse($response); } @@ -61,7 +61,7 @@ public function on404(GetResponseForExceptionEvent $event) { * The event to process. */ public function on405(GetResponseForExceptionEvent $event) { - $response = new JsonResponse([], Response::HTTP_METHOD_NOT_ALLOWED); + $response = new JsonResponse(NULL, Response::HTTP_METHOD_NOT_ALLOWED); $event->setResponse($response); } diff --git a/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php b/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php index 5b62af1..cce6e04 100644 --- a/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php +++ b/core/modules/editor/src/Tests/QuickEditIntegrationLoadingTest.php @@ -90,7 +90,7 @@ public function testUsersWithoutPermission() { // Retrieving the untransformed text should result in an empty 403 response. $response = $this->drupalPost('editor/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', array()); $this->assertResponse(403); - $this->assertIdentical('[]', $response); + $this->assertIdentical('{}', $response); } } diff --git a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php index afdb728..a20663d 100644 --- a/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php +++ b/core/modules/quickedit/src/Tests/QuickEditLoadingTest.php @@ -84,7 +84,7 @@ public function testUserWithoutPermission() { // Retrieving the metadata should result in an empty 403 response. $post = array('fields[0]' => 'node/1/body/en/full'); $response = $this->drupalPost('quickedit/metadata', 'application/json', $post); - $this->assertIdentical('[]', $response); + $this->assertIdentical('{}', $response); $this->assertResponse(403); // Quick Edit's JavaScript would SearchRankingTestnever hit these endpoints if the metadata @@ -92,11 +92,11 @@ public function testUserWithoutPermission() { // able to use any of the other endpoints either. $post = array('editors[0]' => 'form') + $this->getAjaxPageStatePostData(); $response = $this->drupalPost('quickedit/attachments', 'application/vnd.drupal-ajax', $post); - $this->assertIdentical('[]', $response); + $this->assertIdentical('{}', $response); $this->assertResponse(403); $post = array('nocssjs' => 'true') + $this->getAjaxPageStatePostData(); $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $post); - $this->assertIdentical('[]', $response); + $this->assertIdentical('{}', $response); $this->assertResponse(403); $edit = array(); $edit['form_id'] = 'quickedit_field_form'; @@ -107,11 +107,11 @@ public function testUserWithoutPermission() { $edit['body[0][format]'] = 'filtered_html'; $edit['op'] = t('Save'); $response = $this->drupalPost('quickedit/form/' . 'node/1/body/en/full', 'application/vnd.drupal-ajax', $edit); - $this->assertIdentical('[]', $response); + $this->assertIdentical('{}', $response); $this->assertResponse(403); $post = array('nocssjs' => 'true'); $response = $this->drupalPost('quickedit/entity/' . 'node/1', 'application/json', $post); - $this->assertIdentical('[]', $response); + $this->assertIdentical('{}', $response); $this->assertResponse(403); } diff --git a/core/modules/rest/src/Tests/ReadTest.php b/core/modules/rest/src/Tests/ReadTest.php index dda6bc8..c730b89 100644 --- a/core/modules/rest/src/Tests/ReadTest.php +++ b/core/modules/rest/src/Tests/ReadTest.php @@ -60,7 +60,7 @@ public function testRead() { // Try to read an entity that does not exist. $response = $this->httpRequest($entity_type . '/9999', 'GET', NULL, $this->defaultMimeType); $this->assertResponse(404); - $this->assertText('A fatal error occurred: The "' . $entity_type . '" parameter was not converted for the path', 'Response message is correct.'); + $this->assertText(Json::encode(['A fatal error occurred: The "' . $entity_type . '" parameter was not converted for the path']), 'Response message is correct.'); // Make sure that field level access works and that the according field is // not available in the response. Only applies to entity_test. @@ -79,14 +79,14 @@ public function testRead() { $this->drupalLogout(); $response = $this->httpRequest($entity->getSystemPath(), 'GET', NULL, $this->defaultMimeType); $this->assertResponse(403); - $this->assertNull(Json::decode($response), 'No valid JSON found.'); + $this->assertIdentical('{}', $response); } // Try to read a resource which is not REST API enabled. $account = $this->drupalCreateUser(); $this->drupalLogin($account); $response = $this->httpRequest($account->getSystemPath(), 'GET', NULL, $this->defaultMimeType); $this->assertResponse(404); - $this->assertNull(Json::decode($response), 'No valid JSON found.'); + $this->assertIdentical('{}', $response); } /**