Issue 1:
When we create a lazy load service , It is supposed to pass initializer to staticProxyConstructor of a proxy instead of its constructor. I have no idea why this happened, please check this link.

Issue 2:
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:

fos_rest:
param_fetcher_listener: force
routing_loader:
include_format: false
view:
mime_types:
json: ['application/json', 'application/json;version=1.0', 'application/json;version=1.1', 'application/json;version=1.2']
view_response_listener: 'force'
formats:
xml: true
json: true
templating_formats:
html: true
format_listener:
rules:
- { path: ^/, priorities: [ html, json, xml ], fallback_format: ~, prefer_extension: true }
media_type:
version_regex: '/(v|version)=(?P<version>[0-9\.]+)/'
exception:
codes:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
messages:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
allowed_methods_listener: true
access_denied_listener:
json: true
body_listener: true

And this is a part of my controller action:

public function getNewsAction(Request $request)
{
...
$news = [generator news]..
...

$view = $this->view($news);
return $this->handleView($view, 200);
}

I'm trying to debug the following error:

An Exception was thrown while handling: Type error: Argument 1 passed to
FOSRestBundleSerializerSymfonySerializerAdapter_0000000052c9fc6b000000005a32441d7f491784
a700368952f1ec7813de5f79::__construct() must implement interface
Symfony\Component\Serializer\SerializerInterface, instance of Closure given, called in
/tmpfs/dev/cache/appDevDebugProjectContainer.php on line 2766

Even when using the JMSSerializer I get:

An Exception was thrown while handling: Type error: Argument 1 passed to
FOSRestBundleSerializerJMSSerializerAdapter_000000003e79141b0000000013a926a47f491784a70
0368952f1ec7813de5f79::__construct() must implement interface JMS\Serializer\SerializerInterface,
instance of Closure given, called in /tmpfs/dev/cache/appDevDebugProjectContainer.php on line 2789

This is the generated code:

/**
* Gets the 'fos_rest.serializer' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @param bool $lazyLoad whether to try lazy-loading the service with a proxy
*
* @return \FOS\RestBundle\Serializer\JMSSerializerAdapter A FOS\RestBundle\Serializer\JMSSerializerAdapter instance.
*/
public function getFosRest_SerializerService($lazyLoad = true)
{
if ($lazyLoad) {
$container = $this;

return $this->services['fos_rest.serializer'] = new FOSRestBundleSerializerJMSSerializerAdapter_000000003e79141b0000000013a926a47f491784a
700368952f1ec7813de5f79(
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {
$wrappedInstance = $container->getFosRest_SerializerService(false);

$proxy->setProxyInitializer(null);

return true;
}
);
}

return new \FOS\RestBundle\Serializer\JMSSerializerAdapter($this->get('jms_serializer'));
}

Any idea where I should start looking for this problem?

I've also seen it in another project (unsolved).