Fosrestbundle: Fatal Error when using RestBundle with JMSSerializer

Created on 4 Dec 2018  路  10Comments  路  Source: FriendsOfSymfony/FOSRestBundle

i have setup a new project with symfony flex (symfony v4.2).
after that, i install with composer JMSSerializer-Bundle (v3.0).

Now i wan't to install FosRestBundle (v2.4), but when cache was cleared during composer, i got followed error:

In JMSHandlerRegistry.php line 24:
!!                                                                                 
!!    Compile Error: Declaration of FOS\RestBundle\Serializer\JMSHandlerRegistry:  
!!    :registerSubscribingHandler(JMS\Serializer\Handler\SubscribingHandlerInterf  
!!    ace $handler) must be compatible with JMS\Serializer\Handler\HandlerRegistr  
!!    yInterface::registerSubscribingHandler(JMS\Serializer\Handler\SubscribingHa  
!!    ndlerInterface $handler): void      

Most helpful comment

composer req friendsofsymfony/rest-bundle "dev-master"

resolved this error

All 10 comments

i have same problem

The changes required to make FOSRestBundle compatible with JMSSerizerBundle 3 have not been part of a release yet. You will need to allow development dependencies for it for the moment.

You mean install
composer req friendsofsymfony/rest-bundle "dev-master"
?

composer req friendsofsymfony/rest-bundle "dev-master"

resolved this error

Just ran into the same problem when trying to upgrade jms/serializer. Using rest-bundle dev-master indeed fixed the problem. When can we expect a release?

Please release as soon as possible. Thanks in advance :)

Using dev-master in the meanwhile

@xabbuh @GuilhemN What is the reason for the delay? I see that master also has compatibility with SF 4.2 solved and CI is running tests against PHP 7.3. So what else is blocking the release? I was unable to find any milestone or issue tracking the progress of the next version so even if someone wanted to help with a PR, right now they can't.

@enumag I guess it's #1972 that blocks the release. We need to get rid of deprecations with Symfony 4.2 before releasing a new version.
Note that upcoming release is dropping Symfony < 3.4 and JMS Serializer <1.13.

Until the release is out, please either lock your JMS Serializer at 1.13 or use FOSRestBundle dev-master (risky).

1972 would be nice, but is not really a blocker. But #1970 needs to be solved first so that we do not introduce new issues related to maps in query params with the next release.

@xabbuh I think it can be closed, thanks to v2.5.0 release: #1976

Was this page helpful?
0 / 5 - 0 ratings