sonata-project / SonataMediaBundle

Symfony SonataMediaBundle
https://docs.sonata-project.org/projects/SonataMediaBundle
MIT License
449 stars 496 forks source link

Cannot install with PHP 8 #2233

Closed lukepass closed 2 years ago

lukepass commented 2 years ago

Environment

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:    20.04
Codename:   focal

Sonata packages

show

``` $ composer show --latest 'sonata-project/*' sonata-project/admin-bundle 4.4.0 4.4.0 The missing Symfony Admin Generator sonata-project/block-bundle 4.8.0 4.8.0 Symfony SonataBlockBundle sonata-project/cache 2.2.0 2.2.0 Cache library sonata-project/doctrine-extensions 1.15.0 1.15.0 Doctrine2 behavioral extensions sonata-project/exporter 2.9.1 2.9.1 Lightweight Exporter library sonata-project/form-extensions 1.12.3 1.12.3 Symfony form extensions sonata-project/twig-extensions 1.9.0 1.9.0 Sonata twig extensions ```

Symfony packages

show

``` $ composer show --latest 'symfony/*' Color legend: - patch or minor release available - update recommended - major release available - update possible - up to date version symfony/amqp-messenger v5.4.0 v5.4.0 Symfony AMQP extension Messenger Bridge symfony/asset v5.4.0 v6.0.0 Manages URL generation and versioning of web... symfony/cache v5.4.0 v6.0.0 Provides an extended PSR-6, PSR-16 (and tags... symfony/cache-contracts v2.5.0 v3.0.0 Generic abstractions related to caching symfony/config v5.4.0 v6.0.0 Helps you find, load, combine, autofill and ... symfony/console v5.4.0 v6.0.0 Eases the creation of beautiful and testable... symfony/debug-bundle v5.4.0 v6.0.0 Provides a tight integration of the Symfony ... symfony/dependency-injection v5.4.0 v6.0.0 Allows you to standardize and centralize the... symfony/deprecation-contracts v3.0.0 v3.0.0 A generic function and convention to trigger... symfony/doctrine-bridge v5.4.0 v6.0.0 Provides integration for Doctrine with vario... symfony/doctrine-messenger v5.4.0 v6.0.0 Symfony Doctrine Messenger Bridge symfony/dotenv v5.4.0 v6.0.0 Registers environment variables from a .env ... symfony/error-handler v5.4.0 v6.0.0 Provides tools to manage errors and ease deb... symfony/event-dispatcher v5.4.0 v6.0.0 Provides tools that allow your application c... symfony/event-dispatcher-contracts v2.5.0 v3.0.0 Generic abstractions related to dispatching ... symfony/expression-language v5.4.0 v6.0.0 Provides an engine that can compile and eval... symfony/filesystem v5.4.0 v6.0.0 Provides basic utilities for the filesystem symfony/finder v5.4.0 v6.0.0 Finds files and directories via an intuitive... symfony/flex v2.0.1 v2.0.1 Composer plugin for Symfony symfony/form v5.4.0 v6.0.0 Allows to easily create, process and reuse H... symfony/framework-bundle v5.4.0 v6.0.0 Provides a tight integration between Symfony... symfony/http-client v5.4.0 v6.0.0 Provides powerful methods to fetch HTTP reso... symfony/http-client-contracts v2.5.0 v3.0.0 Generic abstractions related to HTTP clients symfony/http-foundation v5.4.0 v6.0.0 Defines an object-oriented layer for the HTT... symfony/http-kernel v5.4.0 v6.0.0 Provides a structured process for converting... symfony/intl v5.4.0 v6.0.0 Provides a PHP replacement layer for the C i... symfony/mailer v5.4.0 v6.0.0 Helps sending emails symfony/maker-bundle v1.36.4 v1.36.4 Symfony Maker helps you create empty command... symfony/messenger v5.4.0 v6.0.0 Helps applications send and receive messages... symfony/mime v5.4.0 v6.0.0 Allows manipulating MIME messages symfony/monolog-bridge v5.4.0 v6.0.0 Provides integration for Monolog with variou... symfony/monolog-bundle v3.7.1 v3.7.1 Symfony MonologBundle symfony/notifier v5.4.0 v6.0.0 Sends notifications via one or more channels... symfony/options-resolver v5.4.0 v6.0.0 Provides an improved replacement for the arr... symfony/password-hasher v5.4.0 v6.0.0 Provides password hashing utilities symfony/polyfill-intl-grapheme v1.23.1 v1.23.1 Symfony polyfill for intl's grapheme_* funct... symfony/polyfill-intl-icu v1.23.0 v1.23.0 Symfony polyfill for intl's ICU-related data... symfony/polyfill-intl-idn v1.23.0 v1.23.0 Symfony polyfill for intl's idn_to_ascii and... symfony/polyfill-intl-normalizer v1.23.0 v1.23.0 Symfony polyfill for intl's Normalizer class... symfony/polyfill-mbstring v1.23.1 v1.23.1 Symfony polyfill for the Mbstring extension symfony/polyfill-php73 v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 7.3+ f... symfony/polyfill-php80 v1.23.1 v1.23.1 Symfony polyfill backporting some PHP 8.0+ f... symfony/polyfill-php81 v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 8.1+ f... symfony/process v5.4.0 v6.0.0 Executes commands in sub-processes symfony/property-access v5.4.0 v6.0.0 Provides functions to read and write from/to... symfony/property-info v5.4.0 v6.0.0 Extracts information about PHP class' proper... symfony/proxy-manager-bridge v5.4.0 v6.0.0 Provides integration for ProxyManager with v... symfony/redis-messenger v5.4.0 v5.4.0 Symfony Redis extension Messenger Bridge symfony/routing v5.4.0 v6.0.0 Maps an HTTP request to a set of configurati... symfony/runtime v5.4.0 v6.0.0 Enables decoupling PHP applications from glo... symfony/security-acl v3.2.0 v3.2.0 Symfony Security Component - ACL (Access Con... symfony/security-bundle v5.4.0 v6.0.0 Provides a tight integration of the Security... symfony/security-core v5.4.0 v6.0.0 Symfony Security Component - Core Library symfony/security-csrf v5.4.0 v6.0.0 Symfony Security Component - CSRF Library symfony/security-guard v5.4.0 v5.4.0 Symfony Security Component - Guard symfony/security-http v5.4.0 v6.0.0 Symfony Security Component - HTTP Integration symfony/serializer v5.4.0 v6.0.0 Handles serializing and deserializing data s... symfony/service-contracts v2.4.1 v3.0.0 Generic abstractions related to writing serv... symfony/stopwatch v5.4.0 v6.0.0 Provides a way to profile code symfony/string v5.4.0 v6.0.0 Provides an object-oriented API to strings a... symfony/translation v5.4.0 v6.0.0 Provides tools to internationalize your appl... symfony/translation-contracts v2.5.0 v3.0.0 Generic abstractions related to translation symfony/twig-bridge v5.4.0 v6.0.0 Provides integration for Twig with various S... symfony/twig-bundle v5.4.0 v6.0.0 Provides a tight integration of Twig into th... symfony/validator v5.4.0 v6.0.0 Provides tools to validate values symfony/var-dumper v5.4.0 v6.0.0 Provides mechanisms for walking through any ... symfony/var-exporter v5.4.0 v6.0.0 Allows exporting any serializable PHP data s... symfony/web-link v5.4.0 v6.0.0 Manages links between resources symfony/web-profiler-bundle v5.4.0 v6.0.0 Provides a development tool that gives detai... symfony/webapp-meta v1.0.0 v1.0.0 A meta package for the web app pack symfony/webpack-encore-bundle v1.13.1 v1.13.1 Integration with your Symfony app & Webpack ... symfony/yaml v5.4.0 v6.0.0 Loads and dumps YAML files ```

PHP version

$ php -v
PHP 8.0.13 (cli) (built: Nov 22 2021 09:50:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies

Subject

Hello, I am trying to install SonataMediaBundle with Symfony 5.4 and PHP 8 but unfortunately it gives an error. I tried many different things:

Experiment 1

composer require sonata-project/media-orm-pack

  [InvalidArgumentException]                                                                      
  Package sonata-project/media-orm-pack has requirements incompatible with your PHP version, PHP  
   extensions and Composer version:                                                               
    - sonata-project/media-orm-pack 1.0.0 requires php ^7.0 which does not match your installed   
  version 8.0.13.                                                                                 

Experiment 2 (without media-orm-pack)

composer require sonata-project/media-bundle
Using version ^3.37 for sonata-project/media-bundle
./composer.json has been updated
Running composer update sonata-project/media-bundle
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "5.4.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires sonata-project/media-bundle ^3.37 -> satisfiable by sonata-project/media-bundle[3.37.0].
    - sonata-project/media-bundle 3.37.0 requires psr/log ^1.0 -> found psr/log[1.0.0, ..., 1.1.4] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require sonata-project/media-bundle:*" to figure out if any version is installable, or "composer require sonata-project/media-bundle:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Experiment 3 (with -W)

composer require sonata-project/media-bundle -W
Using version ^3.37 for sonata-project/media-bundle
./composer.json has been updated
Running composer update sonata-project/media-bundle --with-all-dependencies
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "5.4.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires sonata-project/media-bundle ^3.37 -> satisfiable by sonata-project/media-bundle[3.37.0].
    - sonata-project/media-bundle 3.37.0 requires symfony/console ^4.4 -> found symfony/console[v4.4.0, ..., v4.4.34] but it conflicts with your root composer.json require (5.4.*).

You can also try re-running composer require with an explicit version constraint, e.g. "composer require sonata-project/media-bundle:*" to figure out if any version is installable, or "composer require sonata-project/media-bundle:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Thanks!

Minimal repository with the bug

n/a

Steps to reproduce

Install the package as written above.

Expected results

The package installs correctly.

Actual results

The package gives the above errors.

jordisala1991 commented 2 years ago

You need to use : https://github.com/sonata-project/SonataMediaBundle/releases/tag/4.0.0-RC2

Or downgrade the whole sonata to 3. (Sonata 3 works with php 8)

Closing this as there is no bug to be solved.

lukepass commented 2 years ago

Thanks @jordisala1991 for the quick answer, so the problem is that I installed SonataAdminBundle v4.4 before installing SonataMediaBundle? I tried in an empty project but unfortunately the error is the same.

jordisala1991 commented 2 years ago

The problem is that you need to allow non stable dependencies to make use of media bundle 4.0 rc2

lukepass commented 2 years ago

Ok but if SonataMediaBundle v3 allows PHP 8, why is it showing an error? It's because I already installed SonataAdminBundle v4.4?

jordisala1991 commented 2 years ago

Yes. Composer cant find a stable version of media bundle that matches your previous requirements