Kuestenschmiede / CoreBundle

Core bundle with functionality needed for every con4gis application.
https://con4gis.org
GNU Lesser General Public License v3.0
4 stars 4 forks source link

Clean installation with Contao 4.12.1 fails -> Symfony Controller changes #6

Closed hwit-biz closed 3 years ago

hwit-biz commented 3 years ago

Hi everyone,

with a brand new installation of Contao 4.12.1 I've encountered the following problem:

$ /usr/bin/php7.4 -q -dmax_execution_time=0 -dmemory_limit=-1 -dallow_url_fopen=1 -ddisable_functions= -ddate.timezone=Europe/Berlin /var/www/html/contao/web/contao-manager.phar.php composer install --prefer-dist --no-dev --no-progress --no-ansi --no-interaction --optimize-autoloader Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Package operations: 10 installs, 0 updates, 0 removals As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension. This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost. Installing 'unzip' or '7z' may remediate them.

  • Downloading phayes/geophp (1.2)
  • Downloading menatwork/contao-multicolumnwizard-bundle (3.5.2)
  • Downloading ralouphie/getallheaders (3.0.3)
  • Downloading guzzlehttp/psr7 (1.8.2)
  • Downloading guzzlehttp/promises (1.4.1)
  • Downloading guzzlehttp/guzzle (6.5.5)
  • Downloading con4gis/core (v5.0.9)
  • Downloading mobiledetect/mobiledetectlib (2.8.37)
  • Downloading bugbuster/contao-mobiledetection-bundle (1.0.2)
  • Downloading con4gis/maps (v8.0.22)
  • Installing phayes/geophp (1.2): Extracting archive
  • Installing menatwork/contao-multicolumnwizard-bundle (3.5.2): Extracting archive
  • Installing ralouphie/getallheaders (3.0.3): Extracting archive
  • Installing guzzlehttp/psr7 (1.8.2): Extracting archive
  • Installing guzzlehttp/promises (1.4.1): Extracting archive
  • Installing guzzlehttp/guzzle (6.5.5): Extracting archive
  • Installing con4gis/core (v5.0.9): Extracting archive
  • Installing mobiledetect/mobiledetectlib (2.8.37): Extracting archive
  • Installing bugbuster/contao-mobiledetection-bundle (1.0.2): Extracting archive
  • Installing con4gis/maps (v8.0.22): Extracting archive

Package league/uri-hostname-parser is abandoned, you should avoid using it. No replacement was suggested. Package league/uri-schemes is abandoned, you should avoid using it. No replacement was suggested. Package patchwork/utf8 is abandoned, you should avoid using it. Use symfony/polyfill-mbstring or symfony/string instead. Generating optimized autoload files composer/package-versions-deprecated: Generating version class... composer/package-versions-deprecated: ...done generating version class contao/manager-plugin: Generating plugin class... contao/manager-plugin: ...done generating plugin class Class League\Uri\Schemes\AbstractUri located in ./vendor/league/uri-schemes/src/Schemes/deprecated.php does not comply with psr-4 autoloading standard. Skipping. Class League\Uri\Schemes\Data located in ./vendor/league/uri-schemes/src/Schemes/deprecated.php does not comply with psr-4 autoloading standard. Skipping. Class League\Uri\Schemes\File located in ./vendor/league/uri-schemes/src/Schemes/deprecated.php does not comply with psr-4 autoloading standard. Skipping. Class League\Uri\Schemes\Ftp located in ./vendor/league/uri-schemes/src/Schemes/deprecated.php does not comply with psr-4 autoloading standard. Skipping. Class League\Uri\Schemes\Http located in ./vendor/league/uri-schemes/src/Schemes/deprecated.php does not comply with psr-4 autoloading standard. Skipping. Class League\Uri\Schemes\Uri located in ./vendor/league/uri-schemes/src/Schemes/deprecated.php does not comply with psr-4 autoloading standard. Skipping. Class League\Uri\Schemes\UriException located in ./vendor/league/uri-schemes/src/Schemes/deprecated.php does not comply with psr-4 autoloading standard. Skipping. Class League\Uri\Schemes\Ws located in ./vendor/league/uri-schemes/src/Schemes/deprecated.php does not comply with psr-4 autoloading standard. Skipping. 99 packages you are using are looking for funding. Use the composer fund command to find out more! @php vendor/bin/contao-setup Added the public/app.php file. Added the public/preview.php file. Added the public/index.php file. // Clearing the cache for the prod environment with debug
// false
[OK] Cache for the "prod" environment (debug=false) was successfully cleared.
// Clearing the cache for the dev environment with debug
// true
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
// Warming up the cache for the prod environment with debug
// false
11:25:45 CRITICAL [console] Error thrown while running command "cache:warmup --env=prod --no-ansi". Message: "Class 'Symfony\Bundle\FrameworkBundle\Controller\Controller' not found" ["exception" => Error { …},"command" => "cache:warmup --env=prod --no-ansi","message" => "Class 'Symfony\Bundle\FrameworkBundle\Controller\Controller' not found"] In BaseController.php line 23:

Attempted to load class "Controller" from namespace "Symfony\Bundle\FrameworkBundle\Controller".
Did you forget a "use" statement for another namespace?

cache:warmup [--no-optional-warmers] 11:25:46 CRITICAL [console] An error occurred while using the console. Message: "An error occurred while executing the "/usr/bin/php7.4 /var/www/html/contao/vendor/contao/manager-bundle/bin/contao-console cache:warmup --env=prod --no-ansi" command: 11:25:45 CRITICAL [console] Error thrown while running command "cache:warmup --env=prod --no-ansi". Message: "Class 'Symfony\Bundle\FrameworkBundle\Controller\Controller' not found" ["exception" => Error { …},"command" => "cache:warmup --env=prod --no-ansi","message" => "Class 'Symfony\Bundle\FrameworkBundle\Controller\Controller' not found"] In BaseController.php line 23:

Attempted to load class "Controller" from namespace "Symfony\Bundle\FrameworkBundle\Controller".
Did you forget a "use" statement for another namespace?

cache:warmup [--no-optional-warmers] " ["exception" => RuntimeException { …},"message" => """ An error occurred while executing the "/usr/bin/php7.4 /var/www/html/contao/vendor/contao/manager-bundle/bin/contao-console cache:warmup --env=prod --no-ansi" command: 11:25:45 CRITICAL [console] Error thrown while running command "cache:warmup --env=prod --no-ansi". Message: "Class 'Symfony\Bundle\FrameworkBundle\Controller\Controller' not found" ["exception" => Error { …},"command" => "cache:warmup --env=prod --no-ansi","message" => "Class 'Symfony\Bundle\FrameworkBundle\Controller\Controller' not found"]\n \n In BaseController.php line 23:\n \n Attempted to load class "Controller" from namespace "Symfony\Bundle\Framewo \n rkBundle\Controller". \n Did you forget a "use" statement for another namespace? \n \n \n cache:warmup [--no-optional-warmers]\n \n """] In ContaoSetupCommand.php line 128:

An error occurred while executing the "/usr/bin/php7.4 /var/www/html/contao
/vendor/contao/manager-bundle/bin/contao-console cache:warmup --env=prod --
no-ansi" command: 11:25:45 CRITICAL [console] Error thrown while running c
ommand "cache:warmup --env=prod --no-ansi". Message: "Class 'Symfony\Bundle
\FrameworkBundle\Controller\Controller' not found" ["exception" => Error {
…},"command" => "cache:warmup --env=prod --no-ansi","message" => "Class 'Sy
mfony\Bundle\FrameworkBundle\Controller\Controller' not found"]

In BaseController.php line 23:

Attempted to load class "Controller" from namespace "Symfony\Bundle\FrameworkBundle\Controller".                                                      

Did you forget a "use" statement for another namespace?                    

cache:warmup [--no-optional-warmers]

contao:setup Script @php vendor/bin/contao-setup handling the post-install-cmd event returned with error code 1

Process terminated with exit code 1

Result: General error

In my opinion there's a deprecated linked class to the Symfony Framework bundle. Sadly I'm not able to create a pull request because I'm not getting along with all these Composer and Symfony linkings and class constructs. However, I found the following inside the Symfony changelog:

Removed Controller, use AbstractController instead

Source: https://github.com/symfony/framework-bundle/blob/5.3/CHANGELOG.md#500

So I would suggest to edit https://github.com/Kuestenschmiede/CoreBundle/blob/721dddc9a775eccc66bb1166f9c5a162f3273ab6/Controller/BaseController.php#L18

- use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

and https://github.com/Kuestenschmiede/CoreBundle/blob/721dddc9a775eccc66bb1166f9c5a162f3273ab6/Controller/BaseController.php#L23

- class BaseController extends Controller
+ class BaseController extends AbstractController

Greetings, Harry.

coastforge-mei commented 3 years ago

Fixed in v5.0.11. Thanks for reporting.