Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] Trigger deprecation when could not parse date with default format#58966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
alexndlm wants to merge7 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromalexndlm:feature/serializer-trigger-deprecation-when-could-not-parse-date-with-default-format

Conversation

alexndlm
Copy link
Contributor

QA
Branch?7.3
Bug fix?no
New feature?no
Deprecations?yes
Issues
LicenseMIT

Relates to#43329 (comment)

@alexndlm
Copy link
ContributorAuthor

@nicolas-grekas Could you have a look?

Copy link
Contributor

@mtarldmtarld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could you update the Serializer'sCHANGELOG.md file and theUPGRADE-7.3.md file as well?

@mtarld
Copy link
Contributor

Looks like the tests must be updated to not trigger the deprecation.

@@ -126,6 +126,8 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a
if (false !== $object = $type::createFromFormat($defaultDateTimeFormat, $data, $timezone)) {
return $object;
}

trigger_deprecation('symfony/serializer', '7.3', \sprintf('A "%s" will be thrown when a date could not be parsed using the default format "%s".', NotNormalizableValueException::class, $defaultDateTimeFormat));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think we should trigger a deprecation here only if the fallback manages to instantiate it. The case where the fallback throws an exception (already turned into a NotNormalizableValueException below) should not trigger a deprecation.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

As I understand, in 8.0, the fallback should be removed, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

yes. And that's my point: if the fallback also fails, you already have the same behavior than what would happen in 8.0 and we should not trigger a deprecation in that case as the behavior will not change. Try submittingfoobar as value to reproduce that case.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I have rechecked and now realise that fallback should not be removed in8.0. Fallback should still be used whendatetime_format is set tonull.

@alexndlmalexndlmforce-pushed thefeature/serializer-trigger-deprecation-when-could-not-parse-date-with-default-format branch from66a1ede to663eec5CompareJanuary 13, 2025 17:26
@alexndlm
Copy link
ContributorAuthor

@mtarld I have done with your comments.

@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

@mtarldmtarldAwaiting requested review from mtarld

@stofstofAwaiting requested review from stof

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

5 participants
@alexndlm@mtarld@stof@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp