Skip to content

Commit d058c35

Browse files
Merge branch '3.4' into 4.0
* 3.4: [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 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 18abe8e + 845e06e commit d058c35

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
@@ -21,6 +21,7 @@ CHANGELOG
2121
* added getter for extra attributes in `ExtraAttributesException`
2222
* improved `CsvEncoder` to handle variable nested structures
2323
* CSV headers can be passed to the `CsvEncoder` via the `csv_headers` serialization context variable
24+
* added `$context` when checking for encoding, decoding and normalizing in `Serializer`
2425

2526
3.3.0
2627
-----

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)