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

[FrameworkBundle] Do not load property_access.xml if the component isn't installed#24605

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

Closed
ogizanagi wants to merge2 commits intosymfony:2.7fromogizanagi:fix/2.7/serializer/object_normalizer_ex
Closed

[FrameworkBundle] Do not load property_access.xml if the component isn't installed#24605

ogizanagi wants to merge2 commits intosymfony:2.7fromogizanagi:fix/2.7/serializer/object_normalizer_ex

Conversation

@ogizanagi
Copy link
Contributor

@ogizanagiogizanagi commentedOct 18, 2017
edited
Loading

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#24563 (comment)
LicenseMIT
Doc PRN/A

This PR actually aims tofix#24563 (comment) as the exception introduced in the PR can't be reached anyway when using the FrameworkBundle without the property access component as you'll get:

Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "PropertyAccessor" from namespace "Symfony\Component\PropertyAccess".

With this fix, you properly get:

The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.

Not sure this change really belongs to a patch release, but the original PR was accepted in the 2.7 branch.

Also, I'd rather remove the ObjectNormalizer definition if the component isn't available, as suggested by@xabbuh (#24563 (comment)). But in 2.7, this is the only normalizer registered by default and theSerializerPass throws an exception if no normalizer is registered.

To sum up, either:

  1. we completly prevent using the FrameworkBundle and the serializer without the property access component, even if you don't really care about the ObjectNormalizer because you only use your owns specific ones. (and you'll get the exception hinting to install the property access component)
  2. we allow using the FrameworkBundle and the serializer without the property access component, so we remove the ObjectNormalizer definition, but the user'll get aYou must tag at least one service as "serializer.normalizer" to use the Serializer service exception until he configures a normalizer (and we don't get the hint about installing the property access component to enable the ObjectNormalizer. We already have a suggest entry in the composer.json file, though).

To me option 2 looks better. WDYT?

@ogizanagi
Copy link
ContributorAuthor

Added commit for option 2.

@chalasr
Copy link
Member

My preference goes for option 2 as well.

@nicolas-grekasnicolas-grekas added this to the2.7 milestoneOct 19, 2017
@jakzal
Copy link
Contributor

option 2

@fabpot
Copy link
Member

Thank you@ogizanagi.

@fabpotfabpot closed thisOct 28, 2017
fabpot added a commit that referenced this pull requestOct 28, 2017
…omponent isn't installed (ogizanagi)This PR was squashed before being merged into the 2.7 branch (closes#24605).Discussion----------[FrameworkBundle] Do not load property_access.xml if the component isn't installed| Q             | A| ------------- | ---| Branch?       | 2.7 <!-- see comment below -->| Bug fix?      | yes| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->| Tests pass?   | yes| Fixed tickets |#24563 (comment) <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | N/AThis PR actually aims tofix#24563 (comment) as the exception introduced in the PR can't be reached anyway when using the FrameworkBundle without the property access component as you'll get:> Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "PropertyAccessor" from namespace "Symfony\Component\PropertyAccess".With this fix, you properly get:> The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.Not sure this change really belongs to a patch release, but the original PR was accepted in the 2.7 branch.Also, I'd rather remove the ObjectNormalizer definition if the component isn't available, as suggested by@xabbuh (#24563 (comment)). But in 2.7, this is the only normalizer registered by default and the [`SerializerPass` throws an exception if no normalizer is registered.](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/SerializerPass.php#L46)To sum up, either:1. we completly prevent using the FrameworkBundle and the serializer without the property access component, even if you don't really care about the ObjectNormalizer because you only use your owns specific ones. (and you'll get the exception hinting to install the property access component)2. we allow using the FrameworkBundle and the serializer without the property access component, so we remove the ObjectNormalizer definition, but the user'll get a `You must tag at least one service as "serializer.normalizer" to use the Serializer service` exception until he configures a normalizer (and we don't get the hint about installing the property access component to enable the ObjectNormalizer. We already have a suggest entry in the composer.json file, though).To me option 2 looks better. WDYT?Commits-------d297e27 [FrameworkBundle] Do not load property_access.xml if the component isn't installed
@ogizanagiogizanagi deleted the fix/2.7/serializer/object_normalizer_ex branchOctober 28, 2017 22:14
This was referencedOct 30, 2017
This was referencedNov 10, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

6 participants

@ogizanagi@chalasr@jakzal@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp