Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FrameworkBundle] Avoid warming up the validator cache for non-existent class #20559

Closed
wants to merge 1 commit into from

Conversation

Seldaek
Copy link
Member

@Seldaek Seldaek commented Nov 18, 2016

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

This relates to FriendsOfSymfony/FOSUserBundle#2224 - where basically the cache warmer triggers autoloading of a class that is broken, and it then blows up.

This doesn't fix the problem in itself, loading broken classes will still fail, but it allows us at least to work around it by doing:

        "exclude-from-classmap": [
            "vendor/friendsofsymfony/user-bundle/Propel/"
        ]

And then composer dump-autoload -a to get an authoritative classmap. That way the hasMetadataFor will return false because class_exist() won't try to load the class at all. Without the hasMetadataFor fix though, it calls getMetadataFor which throws an exception in the case the class doesn't exist. I am not sure if that's by design.. that the cache warmer would force you to have classes existing for all your validation definitions.

@XWB
Copy link
Contributor

XWB commented Nov 21, 2016

Wouldn't it be better to have this merged in 3.2?

@fabpot
Copy link
Member

fabpot commented Nov 22, 2016

Thank you @Seldaek.

fabpot added a commit that referenced this pull request Nov 22, 2016
… non-existent class (Seldaek)

This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes #20559).

Discussion
----------

[FrameworkBundle] Avoid warming up the validator cache for non-existent class

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? |no
| Tests pass?   | yes
| License       | MIT

This relates to FriendsOfSymfony/FOSUserBundle#2224 - where basically the cache warmer triggers autoloading of a class that is broken, and it then blows up.

This doesn't fix the problem in itself, loading broken classes will still fail, but it allows us at least to work around it by doing:

```
        "exclude-from-classmap": [
            "vendor/friendsofsymfony/user-bundle/Propel/"
        ]
```

And then `composer dump-autoload -a` to get an authoritative classmap. That way the hasMetadataFor will return false because class_exist() won't try to load the class at all. Without the hasMetadataFor fix though, it calls getMetadataFor which throws an exception in the case the class doesn't exist. I am not sure if that's by design.. that the cache warmer would force you to have classes existing for all your validation definitions.

Commits
-------

cb12f22 [FrameworkBundle] Avoid warming up the validator cache for non-existent classes
@fabpot fabpot closed this Nov 22, 2016
@fabpot fabpot mentioned this pull request Nov 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants