From efd4da3a8f1e961de936457d6eeb18c20f50e637 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sat, 25 Jul 2015 00:16:20 +0100 Subject: [PATCH] Issue #2401159 by kim.pepper, Jaesin: Convert instances of Guzzle getBody(TRUE) --- core/includes/install.core.inc | 4 ++-- core/modules/aggregator/src/Form/OpmlFeedAdd.php | 2 +- core/modules/hal/src/Normalizer/FileEntityNormalizer.php | 2 +- core/modules/system/system.module | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 808520b5ccb5..fb18fe3032ff 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1364,8 +1364,8 @@ function install_retrieve_file($uri, $destination) { } try { - $request = \Drupal::httpClient()->get($uri, array('headers' => array('Accept' => 'text/plain'))); - $data = $request->getBody(TRUE); + $response = \Drupal::httpClient()->get($uri, array('headers' => array('Accept' => 'text/plain'))); + $data = (string) $response->getBody(); if (empty($data)) { return FALSE; } diff --git a/core/modules/aggregator/src/Form/OpmlFeedAdd.php b/core/modules/aggregator/src/Form/OpmlFeedAdd.php index 93437b182657..357d0dc3fcc5 100644 --- a/core/modules/aggregator/src/Form/OpmlFeedAdd.php +++ b/core/modules/aggregator/src/Form/OpmlFeedAdd.php @@ -122,7 +122,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { // @todo Move this to a fetcher implementation. try { $response = $this->httpClient->get($form_state->getValue('remote')); - $data = $response->getBody(TRUE); + $data = (string) $response->getBody(); } catch (RequestException $e) { $this->logger('aggregator')->warning('Failed to download OPML file due to "%error".', array('%error' => $e->getMessage())); diff --git a/core/modules/hal/src/Normalizer/FileEntityNormalizer.php b/core/modules/hal/src/Normalizer/FileEntityNormalizer.php index f993024f6060..52ee04b76839 100644 --- a/core/modules/hal/src/Normalizer/FileEntityNormalizer.php +++ b/core/modules/hal/src/Normalizer/FileEntityNormalizer.php @@ -64,7 +64,7 @@ public function normalize($entity, $format = NULL, array $context = array()) { * {@inheritdoc} */ public function denormalize($data, $class, $format = NULL, array $context = array()) { - $file_data = $this->httpClient->get($data['uri'][0]['value'])->getBody(TRUE); + $file_data = (string) $this->httpClient->get($data['uri'][0]['value'])->getBody(); $path = 'temporary://' . drupal_basename($data['uri'][0]['value']); $data['uri'] = file_unmanaged_save_data($file_data, $path); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 415dc977f6c3..ec71f2b97d47 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1361,9 +1361,9 @@ function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $repl } } try { - $data = \Drupal::httpClient() + $data = (string) \Drupal::httpClient() ->get($url) - ->getBody(TRUE); + ->getBody(); $local = $managed ? file_save_data($data, $path, $replace) : file_unmanaged_save_data($data, $path, $replace); } catch (RequestException $exception) { -- GitLab