-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Type error in appDevDebugProjectContainer when using serializer #17676
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
Comments
Can you show the output of |
|
I'm having the same issue with 3.0. |
@jmcclell: Tested on 1.7.7 of the FOSRestBundle and this is working. |
@jverdeyen isn't this an issue with the 1.8-dev version of FOSRestBundle? |
The feature making use of the lazy services was introduced in the 1.8 dev branch, but it doesn't look that we do anything strange with the lazy services: FriendsOfSymfony/FOSRestBundle@b264edc#diff-6fb4ad4aa9f78da8ab275d84ae7ea143 I try to have a look at this this weekend and figure out if this is an issue in Symfony or in FOSRestBundle. |
https://github.com/jmcclell/symfony-testcase-17676
Here's a basic test case. It actually isn't FOSRestBundle at all. In my case, because I've been using minimum-stability = dev while doing some upgrading and testing of new components, I had updated to the latest Doctrine Migrations which uses the 2.0.x branch of the Proxy package. The bug appears to be with the Proxy package itself, or, perhaps, Symfony's usage of it. I'll be backing to stable versions and avoiding the 2.0.x branch, so that will fix things for me for now, but it looks like this will need addressed from one end or the other at some point. |
The proxy bridge seems to handle the lazy-proxy generation wrong (as now a Closure will be generated) thus the line here: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php#L80 should be changed from: |
@Ocramius could you have a look at this issue please ? |
@boast on a side note, we don't officially support 2.0 versions of ProxyManager, so getting errors when using may totally be expected. |
I know that :) Maybe the BC-break was unintentional? As mentioned before, On Wed, 24 Feb 2016 at 13:08 Christophe Coevoet notifications@github.com
|
Yes, the BC break was intentional here, although I am not sure if I missed it in the upgrade docs. Needs either a context switch (check for PM version) or relying on ProxyManager's factories (which encapsulate this behaviour) |
Ah, no, I documented it, but it's only documented as feature: https://github.com/Ocramius/ProxyManager/blob/6e15877fc03cc211ce798d497a21208a44f7b726/CHANGELOG.md#constructors-in-proxies-are-not-replaced-anymore :-\ |
Yes, I think the quickest fix here would be to add a conditional around
new $proxyClassName or $proxyClassName::staticProxyConstructor() . Since no reflection of the proxy is available there, the quickest solution would be to check for the ProxyManager existence of the StaticProxyConstructor method generator.
|
…anager 2.x by detecting proxy features
I provided a fix via #17919 |
…Manager 2.x by detecting proxy features
…Manager 2.x by detecting proxy features
…Manager 2.x by detecting proxy features
…Manager 2.x by detecting proxy features
…Manager 2.x by detecting proxy features
This PR was merged into the 2.3 branch. Discussion ---------- Fix - #17676 (backport #17919 to 2.3) | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17676 | License | MIT | Doc PR | This is a backport of #17919 Commits ------- 0c6400a #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features
* 2.3: #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features Fix bug when using an private aliased factory service ChoiceFormField of type "select" could be "disabled" Update contributing docs [Console] Fix escaping of trailing backslashes Fix constraint validator alias being required [ci] clone with depth=1 to kill push-forced PRs Add check on If-Range header
* 2.7: #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features Fix bug when using an private aliased factory service ChoiceFormField of type "select" could be "disabled" Update contributing docs [Console] Fix escaping of trailing backslashes Fix constraint validator alias being required [ci] clone with depth=1 to kill push-forced PRs Add check on If-Range header
* 2.8: #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features Fix bug when using an private aliased factory service ChoiceFormField of type "select" could be "disabled" Update contributing docs [Console] Fix escaping of trailing backslashes Fix constraint validator alias being required [ci] clone with depth=1 to kill push-forced PRs Add check on If-Range header
…oxyManager 2.x by detecting proxy features (Ocramius) This PR was submitted for the master branch but it was merged into the 3.0 branch instead (closes #17919). Discussion ---------- #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17676 | License | MIT | Doc PR | Note: tests don't pass because the test asset being used does not respect the return type hints (PHP7) required for ProxyManager v2. Not sure if I should just hack around it, and use the PHP7 hints. Commits ------- a8f1a10 #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features
* 3.0: #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features Fix bug when using an private aliased factory service [Form] fix tests added by #17798 by removing `choices_as_values` [Form] fix FQCN in tests added by #17798 [DependencyInjection] Remove unused parameter of private property bug #17798 [Form] allow `choice_label` option to be `false` [Form] fix tests added by #17760 with FQCN ChoiceFormField of type "select" could be "disabled" Update contributing docs [Console] Fix escaping of trailing backslashes Fix constraint validator alias being required [DependencyInjection] Simplified code in AutowirePass [ci] clone with depth=1 to kill push-forced PRs Add check on If-Range header
Symfony 2.8.1
PHP 7.0.2.1 (debian)
I've enabled the Symonfy serializer.
I'm using the
"friendsofsymfony/rest-bundle": "^1.7"
with the following config:And this is a part of my controller action:
I'm trying to debug the following error:
Even when using the JMSSerializer I get:
This is the generated code:
Any idea where I should start looking for this problem?
I've also seen it in another project (unsolved).
The text was updated successfully, but these errors were encountered: