Skip to content

Commit da19f1c

Browse files
Merge branch '4.0'
* 4.0: [YAML] Issue #26065: leading spaces in YAML multi-line string literals [Bridge\PhpUnit] Exit as late as possible [Bridge\PhpUnit] Cleanup BC layer [PhpBridge] add PHPUnit 7 support to SymfonyTestsListener [Lock] Log already-locked errors as "notice" instead of "warning" add context to serialize and deserialize Update Repository Symlink Helper isCsrfTokenValid() replace string by ?string Document explicitly that dotfiles and vcs files are ignored by default [HttpKernel] don't try to wire Request argument with controller.service_arguments Make kernel build time optionally deterministic Use 0 for unlimited expiry [Routing] fix typo Bump default PHPUnit version from 6.3 to 6.5 do not mock the container builder in tests [Cache][WebProfiler] fix collecting cache stats with sub-requests + allow clearing calls
2 parents a64ee93 + d058c35 commit da19f1c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ CHANGELOG
3030
* added getter for extra attributes in `ExtraAttributesException`
3131
* improved `CsvEncoder` to handle variable nested structures
3232
* CSV headers can be passed to the `CsvEncoder` via the `csv_headers` serialization context variable
33+
* added `$context` when checking for encoding, decoding and normalizing in `Serializer`
3334

3435
3.3.0
3536
-----

Serializer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ public function __construct(array $normalizers = array(), array $encoders = arra
9898
*/
9999
final public function serialize($data, $format, array $context = array())
100100
{
101-
if (!$this->supportsEncoding($format)) {
101+
if (!$this->supportsEncoding($format, $context)) {
102102
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported', $format));
103103
}
104104

105-
if ($this->encoder->needsNormalization($format)) {
105+
if ($this->encoder->needsNormalization($format, $context)) {
106106
$data = $this->normalize($data, $format, $context);
107107
}
108108

@@ -114,7 +114,7 @@ final public function serialize($data, $format, array $context = array())
114114
*/
115115
final public function deserialize($data, $type, $format, array $context = array())
116116
{
117-
if (!$this->supportsDecoding($format)) {
117+
if (!$this->supportsDecoding($format, $context)) {
118118
throw new NotEncodableValueException(sprintf('Deserialization for the format %s is not supported', $format));
119119
}
120120

0 commit comments

Comments
 (0)