contao-community-alliance / contao-multicolumnwizard-bundle

Contao 4 Widget - MultiColumnWizard
GNU Lesser General Public License v3.0
12 stars 12 forks source link

Problem mit Contao 4.11.1 und Parameter "kernel.root_dir" #107

Closed hwit-biz closed 3 years ago

hwit-biz commented 3 years ago

Guten Tag.

Ich habe gestern Abend eine Neuinstallation von Contao 4.11.1 über den Contao-Manager auf einem neuen VPS vorgenommen und bin über ein Problem gestolpert.

Zum Selbermachen:

  1. Contao-Manager im /web Verzeichnis einrichten
  2. Contao-Installation starten (bei mir wurde 4.11.1 geladen)
  3. Im Contao-Manager zum Beispiel con4gis-Maps oder con4gis-Core installieren
  4. Sobald die Installation durch ist kann auf contao/install oder contao/ generell nicht mehr zugegriffen werden > Fehler 500

Ursache:

src/DependencyInjection/MultiColumnWizardExtension.php
Zeile 66:             $container->getParameter('kernel.root_dir'),

Fehlerprotokoll /var/log/apache2/error.log:

[Wed Mar 10 22:45:03.708967 2021] [negotiation:error] [pid 4443] [client xxx] AH00687: Negotiation: discovered file(s) matching request: /var/www/html/contao/web/contao-manager (None could be negotiated)., referer: https://xxx/contao-manager.phar.php/
[Wed Mar 10 22:50:04.279689 2021] [php7:error] [pid 4441] [client xxx] PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException: You have requested a non-existent parameter "kernel.root_dir". Did you mean one of these: "kernel.project_dir", "kernel.build_dir", "kernel.cache_dir", "kernel.logs_dir"? in /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:98\nStack trace:\n#0 /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php(61): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get()\n#1 /var/www/html/contao/vendor/symfony/dependency-injection/Container.php(118): Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag->get()\n#2 /var/www/html/contao/vendor/menatwork/contao-multicolumnwizard-bundle/src/DependencyInjection/MultiColumnWizardExtension.php(66): Symfony\Component\DependencyInjection\Container->getParameter()\n#3 /var/www/html/contao/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php(68): MenAtWork\ in /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php on line 98, referer: https://xxx/contao-manager.phar.php/
[Wed Mar 10 22:51:17.014626 2021] [php7:error] [pid 4442] [client xxx] PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException: You have requested a non-existent parameter "kernel.root_dir". Did you mean one of these: "kernel.project_dir", "kernel.build_dir", "kernel.cache_dir", "kernel.logs_dir"? in /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:98\nStack trace:\n#0 /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php(61): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get()\n#1 /var/www/html/contao/vendor/symfony/dependency-injection/Container.php(118): Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag->get()\n#2 /var/www/html/contao/vendor/menatwork/contao-multicolumnwizard-bundle/src/DependencyInjection/MultiColumnWizardExtension.php(66): Symfony\Component\DependencyInjection\Container->getParameter()\n#3 /var/www/html/contao/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php(68): MenAtWork\ in /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php on line 98
[Wed Mar 10 22:53:20.471104 2021] [php7:warn] [pid 4441] [client xxx] PHP Warning: include(/var/www/html/contao/vendor/codefog/contao-haste/config/upgrade.php): failed to open stream: No such file or directory in /var/www/html/contao/app/Resources/contao/config/runonce.php on line 6, referer: https://xxx/contao-manager.phar.php/
[Wed Mar 10 22:53:20.471136 2021] [php7:warn] [pid 4441] [client xxx] PHP Warning: include(): Failed opening '/var/www/html/contao/vendor/codefog/contao-haste/config/upgrade.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/contao/app/Resources/contao/config/runonce.php on line 6, referer: https://xxx/contao-manager.phar.php/
[Wed Mar 10 23:06:33.865505 2021] [php7:error] [pid 4447] [client xxx] PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException: You have requested a non-existent parameter "kernel.root_dir". Did you mean one of these: "kernel.project_dir", "kernel.build_dir", "kernel.cache_dir", "kernel.logs_dir"? in /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:98\nStack trace:\n#0 /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php(61): Symfony\Component\DependencyInjection\ParameterBag\ParameterBag->get()\n#1 /var/www/html/contao/vendor/symfony/dependency-injection/Container.php(118): Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag->get()\n#2 /var/www/html/contao/vendor/menatwork/contao-multicolumnwizard-bundle/src/DependencyInjection/MultiColumnWizardExtension.php(66): Symfony\Component\DependencyInjection\Container->getParameter()\n#3 /var/www/html/contao/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php(68): MenAtWork\ in /var/www/html/contao/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php on line 98, referer: https://xxx/contao-manager.phar.php/
zonky2 commented 3 years ago

https://github.com/menatwork/contao-multicolumnwizard-bundle/blob/e9594b1b2dbe3684100a8059fb2e99eed3ff2964/src/DependencyInjection/MultiColumnWizardExtension.php#L66

berecont commented 3 years ago

same issue here by installing [omosde/contao-om-backend] communitythread

hwit-biz commented 3 years ago

Ursache für das Problem in Contao 4.11 dürfte folgende Änderung im Hauptcode sein: https://github.com/contao/contao/pull/2774 bzw. https://github.com/contao/contao/pull/2773 Grund hierfür ist wohl die Umstellung von Symfony 4.4 auf Version 5.2 mit der Auswirkung "Do not use Kernel::$rootDir anymore"... Bin leider zu wenig im Code drin, um einen Commit herstellen zu können - löschen der betroffenen Zeile bringt nur weitere Fehler.

berecont commented 3 years ago

there was no problem, when installing first [do-while/contao-backupdb-bundle] and then [omosde/contao-om-backend] (?)

fritzmg commented 3 years ago

Ursache für das Problem in Contao 4.11 dürfte folgende Änderung im Hauptcode sein: contao/contao#2774 bzw. contao/contao#2773

@bamsagla No, that is not the reason. The reason is that the parameter kernel.root_dir is not available in Symfony 5 - or more specifically in version 5.x of symfony/http-kernel. Contao 4.11 supports both Symfony 4 and 5.

fritzmg commented 3 years ago

To avoid such problems in the future it is always best to require all dependencies that this package uses in its composer.json and not rely on anything that the contao/core-bundle requires, because that can always change. In this case, the following packages could be added to the composer.json (in the appropriate version):

BugBuster1701 commented 3 years ago

$container->getParameter('kernel.root_dir'),

dann eben die neue Variante: $container->getParameter('kernel.project_dir'), das sollte doch auch in Symfony 4 funktionieren

fritzmg commented 3 years ago

dann eben die neue Variante: $container->getParameter('kernel.project_dir'), das sollte doch auch in Symfony 4 funktionieren

It's not as simple as that. For some reason, this package uses Contao\CoreBundle\DependencyInjection\Configuration and passes $container->getParameter('kernel.project_dir') as the third parameter. However, the constructor of that class only takes two parameters - and they seem to be used wrong in this case. So I think its usage needs to be evaluated.

stefanheimes commented 3 years ago

I have removed the config part which makes trouble. We didn't need it so we can remove it. There is a new version for testing. If you add this line to the composer.json

"menatwork/contao-multicolumnwizard-bundle":"dev-hotfix/3.4.11-config as 3.4.12"

You can test it. But you can't use it with Symfon 5.2 because there is one requirement wich only allowes symfon 3 and 4

contao-community-alliance/dependency-container

composer why symfony/yaml
contao-community-alliance/dependency-container  2.0.4    requires  symfony/yaml (^3.0 || ^4.0)
contao/calendar-bundle                          4.11.2   requires  symfony/yaml (4.4.* || 5.2.*)
contao/core-bundle                              4.11.2   requires  symfony/yaml (4.4.* || 5.2.*)
contao/faq-bundle                               4.11.2   requires  symfony/yaml (4.4.* || 5.2.*)
contao/installation-bundle                      4.11.2   requires  symfony/yaml (4.4.* || 5.2.*)
contao/manager-bundle                           4.11.2   requires  symfony/yaml (4.4.* || 5.2.*)
contao/news-bundle                              4.11.2   requires  symfony/yaml (4.4.* || 5.2.*)
nelmio/security-bundle                          v2.10.3  requires  symfony/yaml (~2.3|~3.0|~4.0|~5.0)
stefanheimes commented 3 years ago

Fix for Contao 4.11 is on master. Support for symfony 5 needs update from contao-community-alliance/dependency-container.

fritzmg commented 3 years ago

This is still an issue. If you install an extension in Contao 4.11 which requires the MCW, only version 3.4.0 might get installed due to the dependency tree.

Imho MCW should drop the dependency to contao-community-alliance/translator and increase the minimum requirement for contao/core-bundle to ^4.9.

fritzmg commented 3 years ago

111 would fix this issue.

In the mean time you can add

"conflict": {
    "menatwork/contao-multicolumnwizard-bundle": "<3.4.11",
    "menatwork/contao-multicolumnwizard": "<3.3.4"
}

to your root composer.json and run composer update again.

stefanheimes commented 3 years ago

There is a new version 3.5.x which should fix this. So we will close this issue.