Hello,
We upgraded behat and it pulled some 4.0 symfony components and we get the following error
In RemoveUnusedDefinitionsPass.php line 76:
[Exception]
Serialization of 'Closure' is not allowed
Exception trace:
serialize() at /web/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php:76
Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass->process() at /web/vendor/symfony/dependen
cy-injection/Compiler/RepeatedPass.php:57
Symfony\Component\DependencyInjection\Compiler\RepeatedPass->process() at /web/vendor/symfony/dependency-injection/Co
mpiler/Compiler.php:95
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /web/vendor/symfony/dependency-injection/Contai
nerBuilder.php:699
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /web/vendor/behat/behat/src/Behat/Testwork/Cli/A
pplication.php:187
Behat\Testwork\Cli\Application->createContainer() at /web/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:1
61
Behat\Testwork\Cli\Application->createCommand() at /web/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:122
Behat\Testwork\Cli\Application->doRun() at /web/vendor/symfony/console/Application.php:129
Symfony\Component\Console\Application->run() at /web/vendor/behat/behat/bin/behat:34
If we force to use symfony dependency injection to be ^3.0, everything works as normal (tested with 3.4)
"symfony/dependency-injection": "3.3.13"
Looks like this was introduced here: https://github.com/Behat/Behat/pull/1095
Experiencing the same problem here ... even though using Behat 3.4.3 which allegedly fixes the BC break in #1095.
Using:
behat/behat v3.4.3
behat/gherkin v4.5.1
behat/mink v1.7.1
behat/mink-browserkit-driver v1.3.2
behat/mink-extension 2.3.0
behat/transliterator v1.2.0
Had to manually add a dev dependency for symfony/dependency-injection:"3.*".
But this should really be enforced by behat IMO.
Does either dev or release behat work for anyone?
I am having zero luck :(
Left a message on IRC and leaving one here too- Anyone figure this out? I am stumped- the above solutions dont seem to work- I have tried older versions of laravel and older versions of behat and using older versions of symphony di... :(
here is what I posted on IRC channel
"
hello out there! - I have spent most of my day trying to figure out an issue I am having with behat- hoping the behat gods on here might offer some wisdom
7:09 PM Serialization of 'Closure' is not allowed
7:09 PM https://github.com/Behat/Behat/issues/1108
7:10 PM I tried adding a dev dependency as drbyte states- maybe I put it in the wrong place- I am still getting the issue
7:10 PM I have started over with a fresh laravel-
7:11 PM and also tried going back in time to use older checkins of behat- and I end up with the same problem-
7:11 PM In RemoveUnusedDefinitionsPass.php line 75:
7:11 PM Serialization of 'Closure' is not allowed
7:12 PM I am new to behat- so maybe I just don't know what I am doing.. I am hoping to get it to run SOMEHOW-- just so I can learn it- but it appears that the released versions as well as the dev version all give that error.. - should I go back in time and use a very old laravel version? is that the problem?
"
thanks!
Brian
Had to manually add a dev dependency for symfony/dependency-injection:"3.*" in my composer.json:
composer require --dev symfony/dependency-injection:"3.*"
and then
composer update
Not a fan of having to force this.
Been fence-sitting about converting all my tests to something other than behat. This may be the shove I needed to go and do it. Sigh.
Working with Laravel 5.6, I am unable to roll back symfony/dependency-injection and cannot see another work-around here - apologies if I am missing another Issue/PR, as it seems quiet on this one since Dec. However, I _think_ the change referenced above fixes this by providing the service container as a Symfony Reference rather than an object.
I am unfamiliar with Symfony DI, so have had to get to grips with the basics to get this far - as such, I would appreciate some feedback please in case this looks likely to break something non-obvious, or if it's even a sane approach, or misses the point of that class, before tidying up for a PR.
Side-note: I am using this with behat-laravel-extension, which needs a similar tweak to work, but with that, I now have working Behat 3.4.3 with symfony/dependency-injection 4.1.1
@philtweir your change looks legitimate. Please open a PR for it.
Many thanks, PR is open at #1163
Hi, +1 with this problem, would be great if this get solved
Most helpful comment
Hi, +1 with this problem, would be great if this get solved