Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix the example given #59306 (comment)
License MIT

DecoderInterface::decode is supposed to throw scoped exception cf

* @throws UnexpectedValueException
*/
public function decode(string $data, string $format, array $context = []): mixed;

but the YamlEncoder::decode could throw ParseException.
Others similar Encoder, like XmlEncoder or JsonEncoder are throwing NotEncodableValue so I did the same cf example

try {
$encodedJson = json_encode($data, $options);
} catch (\JsonException $e) {
throw new NotEncodableValueException($e->getMessage(), 0, $e);
}

@carsonbot carsonbot added this to the 6.4 milestone Dec 29, 2024
@VincentLanglet VincentLanglet changed the title [Serializer] Fix a typo in NoPrivateNetworkHttpClient [Serializer] Fix exception thrown by YamlEncoder Dec 29, 2024
@VincentLanglet
Copy link
Contributor Author

I don't think UrlSanitizerTest errors are related...

@OskarStark OskarStark changed the title [Serializer] Fix exception thrown by YamlEncoder [Serializer] Fix exception thrown by YamlEncoder Dec 29, 2024
@fabpot
Copy link
Member

fabpot commented Jan 6, 2025

Thank you @VincentLanglet.

@fabpot fabpot merged commit d3583b9 into symfony:6.4 Jan 6, 2025
5 of 11 checks passed
This was referenced Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants