This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier d7e859e3c8 bug #24605 [FrameworkBundle] Do not load property_access.xml if the component 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 | https://github.com/symfony/symfony/pull/24563#issuecomment-337549147 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

This PR actually aims to fix https://github.com/symfony/symfony/pull/24563#issuecomment-337549147 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 (https://github.com/symfony/symfony/pull/24563#issuecomment-336795644). 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
-------

d297e27600 [FrameworkBundle] Do not load property_access.xml if the component isn't installed
2017-10-28 15:12:30 -07:00
.composer Drop hirak/prestissimo 2016-05-12 07:44:15 -05:00
.github Fix 7.2 compat layer 2017-10-09 20:05:34 +02:00
src/Symfony bug #24605 [FrameworkBundle] Do not load property_access.xml if the component isn't installed (ogizanagi) 2017-10-28 15:12:30 -07:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore Add appveyor.yml for C.I. on Windows 2015-08-25 23:41:37 +02:00
.php_cs.dist CS: recover no_break_comment 2017-09-15 12:36:22 +02:00
.travis.yml Fix 7.2 compat layer 2017-10-09 20:05:34 +02:00
appveyor.yml [travis] update to trusty 2017-09-06 17:42:52 +02:00
CHANGELOG-2.2.md Merge branch '2.2' into 2.3 2013-12-03 15:51:26 +01:00
CHANGELOG-2.3.md updated CHANGELOG for 2.3.42 2016-05-30 10:40:50 +02:00
CHANGELOG-2.4.md updated CHANGELOG for 2.4.9 2014-09-03 11:50:09 +02:00
CHANGELOG-2.5.md updated CHANGELOG for 2.5.10 2015-02-02 10:26:02 +01:00
CHANGELOG-2.6.md updated CHANGELOG for 2.6.10 2015-07-13 11:34:21 +02:00
CHANGELOG-2.7.md updated CHANGELOG for 2.7.35 2017-10-05 15:51:42 -07:00
composer.json Add "doctrine/annotations" to top-level composer.json 2017-10-21 16:32:46 -04:00
CONTRIBUTING.md Mention the community review guide 2016-12-18 22:02:35 +01:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.7.35 2017-10-05 15:51:49 -07:00
LICENSE updated LICENSE year 2017-01-02 12:30:00 -08:00
phpunit Using FQ name for PHP_VERSION_ID 2017-06-01 13:44:56 -07:00
phpunit.xml.dist fail when detecting risky tests 2017-04-12 09:39:27 +02:00
README.md Fix minor typo in the main README.md 2017-04-27 20:23:38 +02:00
UPGRADE-2.1.md Remove aligned '=>' and '=' 2014-10-26 08:30:58 +01:00
UPGRADE-2.2.md Merge branch '2.3' into 2.5 2014-10-01 07:50:18 +02:00
UPGRADE-2.3.md [Doc] Use Markdown syntax highlighting 2014-10-01 07:38:33 +02:00
UPGRADE-2.4.md Updated UPGRADE-2.4.md 2015-06-08 16:44:57 +02:00
UPGRADE-2.5.md Merge branch '2.5' into 2.6 2015-01-05 21:59:13 +01:00
UPGRADE-2.6.md Fix grammar 2014-12-30 09:24:50 +01:00
UPGRADE-2.7.md Update UPGRADE-2.7.md 2016-11-07 10:23:54 +03:00
UPGRADE-3.0.md Add missing pieces in the upgrade guide to 3.0 2017-01-27 15:42:16 +01:00

Symfony is a PHP framework for web applications and a set of reusable PHP components. Symfony is used by thousands of web applications (including BlaBlaCar.com and Spotify.com) and most of the popular PHP projects (including Drupal and Magento).

Installation

Documentation

Community

Contributing

Symfony is an Open Source, community-driven project with thousands of contributors. Join them contributing code or contributing documentation.

Security Issues

If you discover a security vulnerability within Symfony, please follow our disclosure procedure.

About Us

Symfony development is sponsored by SensioLabs, led by the Symfony Core Team and supported by Symfony contributors.