Symfony 6.4 dump() function doesn't work in controller/service

98 Views Asked by At

After upgrading to symfony 6.4 I have this error whenever I use dd() or dump() in a controller/service.. . of my symfony application. However, when I use it in twig {{dump()}} it works.

The error I receive is the following:

Attempted to call an undefined method named "getContext" of class "Symfony\Component\VarDumper\Cloner\Data". Did you mean to call "withContext"?

1

There are 1 best solutions below

1
BePi On

Well.. It turns out that even if my composer.lock indicated that I had the version 6.4, the symfony/var-dumper version was still at 5.4 (with no getContext method). I had to manually delete the symfony/var-dumper repository and reinstall it doing composer install

Now I have the proper version with the required method.