From 5724c35d01a48b7fc22a97eb81cc35879b8a8d82 Mon Sep 17 00:00:00 2001 From: jbdebiasio Date: Mon, 24 Sep 2018 14:43:44 +0200 Subject: [PATCH] Cast to string response body --- composer.lock | 65 ++++++++++++++++++++++++--------------------- src/Prismic/Api.php | 2 +- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/composer.lock b/composer.lock index 1b541f86..67f962cc 100644 --- a/composer.lock +++ b/composer.lock @@ -1055,7 +1055,7 @@ "homepage": "http://blog.astrumfutura.com" }, { - "name": "Théo FIDRY", + "name": "Théo Fidry", "email": "theo.fidry@gmail.com" } ], @@ -1728,21 +1728,24 @@ }, { "name": "phpunit/php-file-iterator", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { "php": "^7.1" }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, "type": "library", "extra": { "branch-alias": { @@ -1771,7 +1774,7 @@ "filesystem", "iterator" ], - "time": "2018-06-11T11:44:00+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -1914,16 +1917,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.3.2", + "version": "7.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "34705f81bddc3f505b9599a2ef96e2b4315ba9b8" + "reference": "7b331efabbb628c518c408fdfcaf571156775de2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/34705f81bddc3f505b9599a2ef96e2b4315ba9b8", - "reference": "34705f81bddc3f505b9599a2ef96e2b4315ba9b8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b331efabbb628c518c408fdfcaf571156775de2", + "reference": "7b331efabbb628c518c408fdfcaf571156775de2", "shasum": "" }, "require": { @@ -1994,7 +1997,7 @@ "testing", "xunit" ], - "time": "2018-08-22T06:39:21+00:00" + "time": "2018-09-08T15:14:29+00:00" }, { "name": "pimple/pimple", @@ -2797,16 +2800,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.3.1", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "628a481780561150481a9ec74709092b9759b3ec" + "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/628a481780561150481a9ec74709092b9759b3ec", - "reference": "628a481780561150481a9ec74709092b9759b3ec", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e", + "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e", "shasum": "" }, "require": { @@ -2844,11 +2847,11 @@ "phpcs", "standards" ], - "time": "2018-07-26T23:47:18+00:00" + "time": "2018-09-23T23:08:17+00:00" }, { "name": "symfony/config", - "version": "v2.8.44", + "version": "v2.8.45", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -2905,7 +2908,7 @@ }, { "name": "symfony/console", - "version": "v2.8.44", + "version": "v2.8.45", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -3023,7 +3026,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.44", + "version": "v2.8.45", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -3132,7 +3135,7 @@ }, { "name": "symfony/finder", - "version": "v2.8.44", + "version": "v2.8.45", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -3298,16 +3301,16 @@ }, { "name": "symfony/process", - "version": "v2.8.44", + "version": "v2.8.45", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "cc83afdb5ac99147806b3bb65a3ff1227664f596" + "reference": "4be278e19064c3492095de50c9e375caae569ae1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cc83afdb5ac99147806b3bb65a3ff1227664f596", - "reference": "cc83afdb5ac99147806b3bb65a3ff1227664f596", + "url": "https://api.github.com/repos/symfony/process/zipball/4be278e19064c3492095de50c9e375caae569ae1", + "reference": "4be278e19064c3492095de50c9e375caae569ae1", "shasum": "" }, "require": { @@ -3343,11 +3346,11 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:13:39+00:00" + "time": "2018-08-03T09:45:57+00:00" }, { "name": "symfony/stopwatch", - "version": "v2.8.44", + "version": "v2.8.45", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -3460,16 +3463,16 @@ }, { "name": "symfony/validator", - "version": "v2.8.44", + "version": "v2.8.45", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "30352cf38e35ef34cf60676ee72ff3f84c551fac" + "reference": "131ae089fb441c3bed5cda4335404b5f289f7003" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/30352cf38e35ef34cf60676ee72ff3f84c551fac", - "reference": "30352cf38e35ef34cf60676ee72ff3f84c551fac", + "url": "https://api.github.com/repos/symfony/validator/zipball/131ae089fb441c3bed5cda4335404b5f289f7003", + "reference": "131ae089fb441c3bed5cda4335404b5f289f7003", "shasum": "" }, "require": { @@ -3530,7 +3533,7 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:13:39+00:00" + "time": "2018-08-05T14:25:16+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/Prismic/Api.php b/src/Prismic/Api.php index 7dcba937..68415233 100644 --- a/src/Prismic/Api.php +++ b/src/Prismic/Api.php @@ -229,7 +229,7 @@ public function previewSession(string $token, LinkResolver $linkResolver, string throw Exception\RequestFailureException::fromGuzzleException($guzzleException); } /** @var \Psr\Http\Message\ResponseInterface $response */ - $response = \json_decode($response->getBody()); + $response = \json_decode((string) $response->getBody()); if (isset($response->mainDocument)) { $documents = $this ->query(Predicates::at("document.id", $response->mainDocument), ['ref' => $token, 'lang' => '*'])