1

I am tasked with updating a symfony 2.3 app. It went out of style a loong time ago...

The error I get from both app_dev.php and when trying to run the symfony console is:

Fatal error: Cannot use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag as ParameterBag because the name is already in use in /myPath/app/bootstrap.php.cache on line 1958

I googled it, and the suggestion is to run cache:clear which obviously creates a catch22 situation for me. The other suggestion I found was to do composer update or composer install, which doesn't work either due to this little fella:

This thread (https://github.com/composer/composer/issues/9402) suggests to use a different version of sensio distribution bundle, for instance 3.0.36 is supposed to work with symfony 2.3.

I also had to downgrade composer to 2.2 in order to install according to these packages (otherwise some eventDispatcher or other was not compatible). After composer has gone it's course, though, I still end up with the initial parameterBag error at the top.

Is there a way of fixing this? Not permanently, the aim is to move through deprecations one by one, but in order to do that I would need to get the app up and running in it's "old self" =)

I also tried these suggestions (Symfony missing bootstrap.php.cache). Manually running the script to generate the bootstrap file doesn't help, and removing the bootstrap file and commenting it out in app.php and app_dev.php certainly doesn't help, then it just goes on to complain about

Fatal error: Uncaught Error: Class "Symfony\Component\HttpKernel\Kernel" not found in... 

So I assume that comment was aimed at a much later version of symfony.

I know that all my dependencies are extremely old, the pan is to get it up and running, and start updating/migrating one step at a time.

{ "name": "symfony/framework-standard-edition", "license": "MIT", "type": "project", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.3.*", "doctrine/orm": ">=2.2.3,<2.4-dev", "doctrine/doctrine-bundle": "1.2.*", "twig/extensions": "1.0.*", "symfony/assetic-bundle": "2.3.*", "symfony/swiftmailer-bundle": "2.3.*", "symfony/monolog-bundle": "2.3.*", "sensio/distribution-bundle": "3.0.36", "sensio/framework-extra-bundle": "2.3.*", "sensio/generator-bundle": "2.3.*", "incenteev/composer-parameter-handler": "~2.0", "friendsofsymfony/user-bundle": "2.0.0-alpha1", "avalanche123/imagine-bundle": "v2.1" }, "scripts": { "post-install-cmd": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" ], "post-update-cmd": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" ] }, "config": { "bin-dir": "bin" }, "minimum-stability": "stable", "extra": { "symfony-app-dir": "app", "symfony-web-dir": "web", "incenteev-parameters": { "file": "app/config/parameters.yml" }, "branch-alias": { "dev-master": "2.3-dev" } } } 
2
  • Having googled "ParameterBag as ParameterBag because the name is already in use in", the only other hit I get is this from 2022: github.com/symfony/symfony/discussions/46848 Given that this doesn't seem to have been reported back in the days when Symfony 2 was supported, I wonder if the incompatibilty is with something that's been released long after mainstream use of Symfony 2 had ended. Could you set the versions of everything? e.g. php 5 + set all composer dependencies to the latest patches available on a specific date when Symfony 2.3 was widely used, e.g. 2015-06-30 Commented Aug 28, 2023 at 3:37
  • Been a long time but as I recall the bootstrap file is not actually needed. Try editing app/console and comment out the require statement and see what happens. Might just get a different error but maybe not. And yes you will need quite a bit of old stuff. Maybe you could track down a docker configuration? Commented Aug 28, 2023 at 11:38

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.