Repository navigation
fix(serializer): Catch MissingConstructorArgumentsException - #8659
Merged
soyuka merged 1 commit intoOct 9, 2026
Merged
Conversation
bram123
force-pushed
the
catch_missing_constructor_param_exception
branch
from
October 9, 2026 09:22
619335f to
e1cd400
Compare
bram123
force-pushed
the
catch_missing_constructor_param_exception
branch
from
October 9, 2026 09:24
e1cd400 to
d43e8b0
Compare
Contributor
Author
|
PHPStan warning should be unrelated to me adding an extra catch statement |
Member
|
thanks! |
bram123
added a commit
to bram123/core
that referenced
this pull request
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When you have an input DTO with required constructor params, and a request comes in without those fields, API-Platform would leak information about the internal API codebase.
This is now caught and a generic "The input data is misformatted." is used instead.
Created new
testCustomInputRejectsBadTypeMissingConstructorParamto assert the new behaviour.Before:
Cannot create an instance of "ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\JsonLd\RequiredConstructorInputDto" from serialized data...After:
The input data is misformatted.The existing
NotNormalizableValueExceptioncatch (asserted bytestCustomInputRejectsBadType) already turnsThe type of the "bar" attribute must be "int|null", "string" given.into
The input data is misformatted.