-
-
Notifications
You must be signed in to change notification settings - Fork 75
Comparing changes
Open a pull request
base repository: symfony/serializer
base: v7.3.0
head repository: symfony/serializer
compare: v7.3.1
- 11 commits
- 10 files changed
- 5 contributors
Commits on Jun 17, 2025
-
Fix TraceableSerializer when collected caller from array map
If the TraceableSerializer runs from a callable in an array_map, then the caller looses the file and the line because it was invoked. This causes a hard fail since the required items are not defined. The error is the following: TraceableSerializer.php line 174: Warning: Undefined array key "file". The fix is to get the file and the line from the following array item which always is the caller class.
Configuration menu - View commit details
-
Copy full SHA for 987915b - Browse repository at this point
Copy the full SHA 987915bView commit details
Commits on Jun 19, 2025
-
[Serializer] Add support for discriminator map in property normalizer
Fixes #60214 Currently it's not possible to serialize an object using the PropertyNormalizer when a DiscriminatorMap attribute is used. It produces the following error: > Symfony\Component\Serializer\Exception\NotNormalizableValueException: Type property "type" not found > for the abstract object "Symfony\Component\Serializer\Tests\Fixtures\DummyMessageInterface". The ObjectNormalizer overrides the `getAllowedAttributes` from AbstractNormalizer and adds support for discriminators. But the PropertyNormalizer does not do this. Therefore it doesn't work. For now, we copy the logic from ObjectNormalizer to PropertyNormalizer and the problem goes away.
Configuration menu - View commit details
-
Copy full SHA for b828e2a - Browse repository at this point
Copy the full SHA b828e2aView commit details -
bug #60809 [Serializer] Fix
TraceableSerializerwhen called from a ……callable inside `array_map` (OrestisZag) This PR was merged into the 6.4 branch. Discussion ---------- [Serializer] Fix `TraceableSerializer` when called from a callable inside `array_map` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT If the `TraceableSerializer` runs from a callable in an `array_map`, then the caller looses the file and the line because it was invoked. This causes a hard fail since the required items are not defined. The error is the following: ``` TraceableSerializer.php line 174: Warning: Undefined array key "file". ``` The fix is to get the file and the line from the following array item which always is the caller class. Commits ------- 490a110 Fix TraceableSerializer when collected caller from array map
Configuration menu - View commit details
-
Copy full SHA for 492c751 - Browse repository at this point
Copy the full SHA 492c751View commit details -
* 6.4: [Validator] Remove comment to GitHub issue [Serializer] Add support for discriminator map in property normalizer [DependencyInjection] Fix inlining when public services are involved fix contracts directory name Fix TraceableSerializer when collected caller from array map [HttpClient] Limit curl's connection cache size [FrameworkBundle] Fix argument not provided to `add_bus_name_stamp_middleware`
Configuration menu - View commit details
-
Copy full SHA for 8d5af62 - Browse repository at this point
Copy the full SHA 8d5af62View commit details -
* 7.2: [Validator] Remove comment to GitHub issue [Serializer] Add support for discriminator map in property normalizer [DependencyInjection] Fix inlining when public services are involved fix contracts directory name Fix TraceableSerializer when collected caller from array map [HttpClient] Limit curl's connection cache size [FrameworkBundle] Fix argument not provided to `add_bus_name_stamp_middleware`
Configuration menu - View commit details
-
Copy full SHA for d3cf71f - Browse repository at this point
Copy the full SHA d3cf71fView commit details
Commits on Jun 27, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 0aa40bf - Browse repository at this point
Copy the full SHA 0aa40bfView commit details -
bug #60820 [TypeInfo] Fix handling
ConstFetchNode(norkunas)This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [TypeInfo] Fix handling `ConstFetchNode` | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #... | License | MIT I cannot upgrade to 7.3 because I get: ``` In StringTypeResolver.php line 88: !! !! Cannot resolve "array{requirement: ProductLicense::SYSTEM_REQUIREMENT_*, va !! lue: non-empty-string}". !! !! !! In StringTypeResolver.php line 142: !! !! Unhandled "PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode" constant expr !! ession. !! ``` Commits ------- 03cc607 [TypeInfo] Fix handling `ConstFetchNode`Configuration menu - View commit details
-
Copy full SHA for d35f516 - Browse repository at this point
Copy the full SHA d35f516View commit details -
Configuration menu - View commit details
-
Copy full SHA for b91a31c - Browse repository at this point
Copy the full SHA b91a31cView commit details -
bug #60413 [Serializer] Fix collect_denormalization_errors flag in de…
…faultContext (dmbrson) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Serializer] Fix collect_denormalization_errors flag in defaultContext | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #59721 | License | MIT When using the `COLLECT_DENORMALIZATION_ERRORS` flag during denormalization, Symfony should collect **all errors** and report them together in a `PartialDenormalizationException`. Here is an example with two expected errors: ```php final readonly class Foo { public function __construct( public string $bar, public \DateTimeInterface $createdAt, ) {} } $foo = $this->denormalizer->denormalize( data: ['createdAt' => ''], type: Foo::class, ); ``` Expected errors 1. `Failed to create object because the class misses the "bar" property.` 2. `The data is either not a string, an empty string, or null; you should pass a string that can be parsed with the passed format or a valid DateTime string.` --- When the flag is passed via the `context` ```php $foo = $this->denormalizer->denormalize( data: ['createdAt' => ''], type: Foo::class, context: [ DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS => true, ], ); ``` Both errors are correctly collected and returned. When the flag is set via `default_context` in `framework.yaml`: ```yaml serializer: default_context: collect_denormalization_errors: true ``` Only one error is returned: `The data is either not a string, an empty string, or null; you should pass a string that can be parsed with the passed format or a valid DateTime string.` #Root Cause The issue originates in the` \src\Symfony\Component\Serializer\Serializer.php`, `function normalize` : ```php if (isset($context[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS]) || isset($this->defaultContext[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS])) { unset($context[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS]); $context['not_normalizable_value_exceptions'] = []; $errors = &$context['not_normalizable_value_exceptions']; $denormalized = $normalizer->denormalize($data, $type, $format, $context); } ``` The first time this block is hit, it checks for the flag either in $context or $defaultContext. If found, it initializes the error array with: ```php $context['not_normalizable_value_exceptions'] = []; ``` However, during nested denormalization (e.g., when parsing the `createdAt` field), Symfony re-enters this code path. If the flag was provided via `defaultContext`, it is still present on re-entry. Therefore, the `not_normalizable_value_exceptions` array is reset again, losing the previously collected errors. #My Fix The fix is to enhance the condition with an additional check to ensure the array of errors is not already initialized: ```php if ( (isset($context[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS]) || isset($this->defaultContext[DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS])) && !isset($context['not_normalizable_value_exceptions']) ) ``` This ensures the array is only initialized once, preserving previously collected errors in recursive calls, regardless of whether the flag was passed via context or default_context. Commits ------- d4a71ee [Serializer] Fix collect_denormalization_errors flag in defaultContextConfiguration menu - View commit details
-
Copy full SHA for b40a697 - Browse repository at this point
Copy the full SHA b40a697View commit details -
* 6.4: [Console] Table counts wrong column width when using colspan and `setColumnMaxWidth()` [Console] Table counts wrong number of padding symbols in `renderCell()` method when cell contain unicode variant selector [Cache] Fix using a `ChainAdapter` as an adapter for a pool [Serializer] Fix collect_denormalization_errors flag in defaultContext [VarDumper] Avoid deprecated call in PgSqlCaster Fix command option mode (InputOption::VALUE_REQUIRED) [Uid] Improve entropy of the increment for UUIDv7
Configuration menu - View commit details
-
Copy full SHA for d84f0b7 - Browse repository at this point
Copy the full SHA d84f0b7View commit details -
* 7.2: - [Console] Table counts wrong column width when using colspan and `setColumnMaxWidth()` [Console] Table counts wrong number of padding symbols in `renderCell()` method when cell contain unicode variant selector [Cache] Fix using a `ChainAdapter` as an adapter for a pool [Serializer] Fix collect_denormalization_errors flag in defaultContext [TypeInfo] Fix handling `ConstFetchNode` [VarDumper] Avoid deprecated call in PgSqlCaster Fix command option mode (InputOption::VALUE_REQUIRED) use an EOL-agnostic approach to parse class uses [Uid] Improve entropy of the increment for UUIDv7 [HttpKernel] Fix `#[MapUploadedFile]` handling for optional file uploads
Configuration menu - View commit details
-
Copy full SHA for feaf837 - Browse repository at this point
Copy the full SHA feaf837View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v7.3.0...v7.3.1