Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Broken container using lazy service and FOSRestBundle #19229

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

Closed
cmodijk opened this issue Jun 29, 2016 · 2 comments
Closed

Broken container using lazy service and FOSRestBundle #19229

cmodijk opened this issue Jun 29, 2016 · 2 comments

Comments

@cmodijk
Copy link

cmodijk commented Jun 29, 2016

When I install a clean symfony 3 installation and try to install the FOSRestBundle with JMS Serializer bundle and Ocramius Proxy manager i'm getting the following error. The ocramius/proxy-manager is not a direct dependency of our project but is used by doctrine/migrations so we can't remove it and not use lazy services to fix it.

PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting identifier (T_STRING) in /Users/cliff/Desktop/broken-build/var/cache/dev/appDevDebugProjectContainer.php:4350
Stack trace:
#0 /Users/cliff/Desktop/broken-build/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(117): Symfony\Component\HttpKernel\Kernel->initializeContainer()
#1 /Users/cliff/Desktop/broken-build/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#2 /Users/cliff/Desktop/broken-build/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /Users/cliff/Desktop/broken-build/bin/console(29): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#4 {m in /Users/cliff/Desktop/broken-build/var/cache/dev/appDevDebugProjectContainer.php on line 4350

The error is because the cached container has a extra backslash when duping the proxy to the JMS class. This is what i find in the appDevDebugProjectContainer.php file

class FOSRestBundleSerializerJMSSerializerAdapter_000000000f6a855c00000000741b19650bc0c776f79a47453bb599409d6af675 extends \\FOS\RestBundle\Serializer\JMSSerializerAdapter implements \\ProxyManager\Proxy\VirtualProxyInterface
{

Steps to reproduce

$ symfony new broken-build 3.0
$ cd broken-build
$ composer require friendsofsymfony/rest-bundle
$ composer require jms/serializer-bundle
$ composer require ocramius/proxy-manager

# Add bundles to app/AppKernel.php
# new JMS\SerializerBundle\JMSSerializerBundle(),
# new FOS\RestBundle\FOSRestBundle(),

$ ./bin/console 

From these same steps i have created a project which you can find here https://github.com/cmodijk/broken-lazy-proxy

I'm not sure where to post this because i'm not sure what's going wrong.

php -v
PHP 7.0.7 (cli) (built: May 27 2016 11:13:44) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
@cmodijk cmodijk changed the title Broken container using lazy service of FOSRestBundle Broken container using lazy service and FOSRestBundle Jun 29, 2016
@xabbuh
Copy link
Member

xabbuh commented Jun 29, 2016

Please have a look at zendframework/zend-code#74. As a workaround you can temporarily stick to version 3.0.2 of the zendframework/zend-code package until they publish a new release.

@xabbuh xabbuh closed this as completed Jun 29, 2016
@cmodijk
Copy link
Author

cmodijk commented Jun 29, 2016

@xabbuh Tnx! I have searched and try to debug this for two hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants