Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/serializer/Encoder/JsonEncode.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/symfony/serializer/Encoder/JsonEncode.php Mon Apr 23 09:33:26 2018 +0100 +++ b/vendor/symfony/serializer/Encoder/JsonEncode.php Mon Apr 23 09:46:53 2018 +0100 @@ -11,7 +11,7 @@ namespace Symfony\Component\Serializer\Encoder; -use Symfony\Component\Serializer\Exception\UnexpectedValueException; +use Symfony\Component\Serializer\Exception\NotEncodableValueException; /** * Encodes JSON data. @@ -21,7 +21,6 @@ class JsonEncode implements EncoderInterface { private $options; - private $lastError = JSON_ERROR_NONE; public function __construct($bitmask = 0) { @@ -39,8 +38,8 @@ $encodedJson = json_encode($data, $context['json_encode_options']); - if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) { - throw new UnexpectedValueException(json_last_error_msg()); + if (JSON_ERROR_NONE !== json_last_error() && (false === $encodedJson || !($context['json_encode_options'] & JSON_PARTIAL_OUTPUT_ON_ERROR))) { + throw new NotEncodableValueException(json_last_error_msg()); } return $encodedJson; @@ -57,8 +56,6 @@ /** * Merge default json encode options with context. * - * @param array $context - * * @return array */ private function resolveContext(array $context = array())