ecphp / cas-bundle

CAS Bundle, a standard Symfony bundle for authentication using CAS protocol.
https://ecphp-cas-bundle.readthedocs.io
BSD 3-Clause "New" or "Revised" License
43 stars 9 forks source link

Installation issue with Symfony 6.3. #92

Closed habib-halaoui closed 1 year ago

habib-halaoui commented 1 year ago

Steps required to reproduce the problem

I'm using Symfony version 6.3 and PHP version 8.2. After installing the bundle, I encountered this error during cache clearing. I had to downgrade the psr/http-message version to 1.1 in order to be able to install it.

Actual Result

drupol commented 1 year ago

Hi,

I can't reproduce the issue:

❯ symfony new symfony-6.3 --version="6.3.*" --webapp
* Creating a new Symfony 6.3.* project with Composer
* Setting up the project under Git version control
  (running git init /home/devlin/Code/tmp/symfony-6.3)

 [OK] Your project is now ready in /home/devlin/Code/tmp/symfony-6.3                                                    

❯ cd symfony-6.3/
❯ ll
Permissions Size User   Date Modified Name
.rw-r--r--  2.0k devlin  6 Sep 11:19  .env
.rw-r--r--   215 devlin  6 Sep 11:19  .env.test
drwxr-xr-x     - devlin  6 Sep 11:19  .git
.rw-r--r--   375 devlin  6 Sep 11:19  .gitignore
drwxr-xr-x     - devlin  6 Sep 11:19  bin
.rw-r--r--  3.0k devlin  6 Sep 11:19  composer.json
.rw-r--r--  351k devlin  6 Sep 11:19  composer.lock
drwxr-xr-x     - devlin  6 Sep 11:19  config
.rw-r--r--   251 devlin  6 Sep 11:19  docker-compose.override.yml
.rw-r--r--   727 devlin  6 Sep 11:19  docker-compose.yml
drwxr-xr-x     - devlin  6 Sep 11:19  migrations
.rw-r--r--  1.2k devlin  6 Sep 11:19  phpunit.xml.dist
drwxr-xr-x     - devlin  6 Sep 11:19  public
drwxr-xr-x     - devlin  6 Sep 11:19  src
.rw-r--r--  7.4k devlin  6 Sep 11:19  symfony.lock
drwxr-xr-x     - devlin  6 Sep 11:19  templates
drwxr-xr-x     - devlin  6 Sep 11:19  tests
drwxr-xr-x     - devlin  6 Sep 11:19  translations
drwxrwxrwx     - devlin  6 Sep 11:19  var
drwxr-xr-x     - devlin  6 Sep 11:19  vendor
❯ composer require ecphp/cas-bundle
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been updated
Running composer update ecphp/cas-bundle
Loading composer repositories with package information
Updating dependencies
Lock file operations: 11 installs, 0 updates, 0 removals
  - Locking ecphp/cas-bundle (2.5.5)
  - Locking ecphp/cas-lib (1.1.9)
  - Locking league/uri-components (2.4.2)
  - Locking league/uri-interfaces (2.3.0)
  - Locking loophp/psr-http-message-bridge-bundle (1.0.0)
  - Locking nyholm/psr7 (1.8.0)
  - Locking openlss/lib-array2xml (1.0.0)
  - Locking psr/http-client (1.0.2)
  - Locking psr/http-factory (1.0.2)
  - Locking psr/http-message (1.1)
  - Locking symfony/psr-http-message-bridge (v2.3.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 11 installs, 0 updates, 0 removals
  - Downloading symfony/psr-http-message-bridge (v2.3.1)
  - Installing psr/http-message (1.1): Extracting archive
  - Installing psr/http-client (1.0.2): Extracting archive
  - Installing symfony/psr-http-message-bridge (v2.3.1): Extracting archive
  - Installing loophp/psr-http-message-bridge-bundle (1.0.0): Extracting archive
  - Installing psr/http-factory (1.0.2): Extracting archive
  - Installing nyholm/psr7 (1.8.0): Extracting archive
  - Installing openlss/lib-array2xml (1.0.0): Extracting archive
  - Installing league/uri-interfaces (2.3.0): Extracting archive
  - Installing league/uri-components (2.4.2): Extracting archive
  - Installing ecphp/cas-lib (1.1.9): Extracting archive
  - Installing ecphp/cas-bundle (2.5.5): Extracting archive
Generating autoload files
113 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Symfony operations: 3 recipes (7af9ec14cdf8d5cd94edb799dd7fa38f)
  - Configuring loophp/psr-http-message-bridge-bundle (>=1.0.0): From auto-generated recipe
  - Configuring nyholm/psr7 (>=1.0): From github.com/symfony/recipes:main
  -  WARNING  ecphp/cas-bundle (>=2.0): From github.com/symfony/recipes-contrib:main
    The recipe for this package comes from the "contrib" repository, which is open to community contributions.
    Review the recipe at https://github.com/symfony/recipes-contrib/tree/main/ecphp/cas-bundle/2.0

    Do you want to execute this recipe?
    [y] Yes
    [n] No
    [a] Yes for all packages, only for the current installation session
    [p] Yes permanently, never ask again for this project
    (defaults to n): y
  - Configuring ecphp/cas-bundle (>=2.0): From github.com/symfony/recipes-contrib:main
Executing script cache:clear [OK]
Executing script assets:install public [OK]

 What's next? 

Some files have been created and/or updated to configure your new packages.
Please review, edit and commit them: these files are yours.

No security vulnerability advisories found
Using version ^2.5 for ecphp/cas-bundle
❯ symfony serve
Following Web Server log file (/home/devlin/.symfony5/log/88d0c5f60c19c96527fbeef0f79dcd6008d17b4d.log)
Following PHP-FPM log file (/home/devlin/.symfony5/log/88d0c5f60c19c96527fbeef0f79dcd6008d17b4d/53fb8ec204547646acb3461995e4da5a54cc7575.log)

 [WARNING] The local web server is optimized for local development and MUST never be used in a production setup.        

 [OK] Web server listening                                                                                              
      The Web server is using PHP FPM 8.2.9                                                                             
      https://127.0.0.1:8001                                                                                            

[Web Server ] Sep  6 11:22:29 |DEBUG  | PHP    Reloading PHP versions 
[Web Server ] Sep  6 11:22:29 |DEBUG  | PHP    Using PHP version 8.2.9 (from default version in $PATH) 
[Application] Sep  6 09:19:21 |INFO   | DEPREC User Deprecated: The "Monolog\Logger" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Bridge\Monolog\Logger". 
[Application] Sep  6 09:22:18 |INFO   | DEPREC User Deprecated: The "Monolog\Logger" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Bridge\Monolog\Logger". 
[Web Server ] Sep  6 11:22:29 |INFO   | PHP    listening path="/nix/store/sgdadwwpiyxxm0hywb5a5a2j5gcz30w7-php-with-extensions-8.2.9/bin/php-fpm" php="8.2.9" port=46135
[PHP-FPM    ] Sep  6 11:22:31 |NOTICE | FPM    fpm is running, pid 109309 
[PHP-FPM    ] Sep  6 11:22:31 |NOTICE | FPM    ready to handle connections 
[PHP-FPM    ] Sep  6 11:22:31 |NOTICE | FPM    systemd monitor interval set to 10000ms 
[Application] Sep  6 09:22:34 |ERROR  | REQUES Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET https://127.0.0.1:8001/"" at /home/devlin/Code/tmp/symfony-6.3/vendor/symfony/http-kernel/EventListener/RouterListener.php line 127 
[Application] Sep  6 09:22:34 |INFO   | REQUES Matched route "_wdt". method="GET" request_uri="https://127.0.0.1:8001/_wdt/13d9f4" route="_wdt" route_parameters={"_controller":"web_profiler.controller.profiler::toolbarAction","_route":"_wdt","token":"13d9f4"}
[Web Server ] Sep  6 11:22:34 |WARN   | SERVER GET  (404) / ip="127.0.0.1"
[Web Server ] Sep  6 11:22:34 |INFO   | SERVER GET  (200) /_wdt/13d9f4 
^C
Shutting down!

 [OK] Stopped all processes successfully                                                                                

~/C/t/symfony-6.3 > main +779 -2 [!?] > php@8.2.9 ❯

Could you please provide a simple reproducer ? Thanks!

habib-halaoui commented 1 year ago

Hello, I am using composer.json for my current project, and I believe there are dependencies that are causing the encountered error.

composer.txt

drupol commented 1 year ago

Going to check.

drupol commented 1 year ago

I can now reproduce the issue:

❯ composer require ecphp/cas-bundle
./composer.json has been updated
Running composer update ecphp/cas-bundle
Loading composer repositories with package information
Updating dependencies
Lock file operations: 7 installs, 0 updates, 0 removals
  - Locking ecphp/cas-bundle (2.5.5)
  - Locking ecphp/cas-lib (1.1.9)
  - Locking league/uri-components (2.4.2)
  - Locking league/uri-interfaces (2.3.0)
  - Locking loophp/psr-http-message-bridge-bundle (1.0.0)
  - Locking openlss/lib-array2xml (1.0.0)
  - Locking symfony/psr-http-message-bridge (v2.3.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 7 installs, 0 updates, 0 removals
  - Installing symfony/psr-http-message-bridge (v2.3.1): Extracting archive
  - Installing loophp/psr-http-message-bridge-bundle (1.0.0): Extracting archive
  - Installing openlss/lib-array2xml (1.0.0): Extracting archive
  - Installing league/uri-interfaces (2.3.0): Extracting archive
  - Installing league/uri-components (2.4.2): Extracting archive
  - Installing ecphp/cas-lib (1.1.9): Extracting archive
  - Installing ecphp/cas-bundle (2.5.5): Extracting archive
Generating autoload files
113 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Symfony operations: 2 recipes (9432a3d640fed5ff36977c5578f6c528)
  - Configuring loophp/psr-http-message-bridge-bundle (>=1.0.0): From auto-generated recipe
  -  WARNING  ecphp/cas-bundle (>=2.0): From github.com/symfony/recipes-contrib:main
    The recipe for this package comes from the "contrib" repository, which is open to community contributions.
    Review the recipe at https://github.com/symfony/recipes-contrib/tree/main/ecphp/cas-bundle/2.0

    Do you want to execute this recipe?
    [y] Yes
    [n] No
    [a] Yes for all packages, only for the current installation session
    [p] Yes permanently, never ask again for this project
    (defaults to n): a
  - Configuring ecphp/cas-bundle (>=2.0): From github.com/symfony/recipes-contrib:main
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  
!!  In DefinitionErrorExceptionPass.php line 49:
!!                                                                                 
!!    Cannot autowire service "Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFacto  
!!    ry": argument "$serverRequestFactory" of method "__construct()" references   
!!    interface "Psr\Http\Message\ServerRequestFactoryInterface" but no such serv  
!!    ice exists. Did you create a class that implements this interface?           
!!                                                                                 
!!  
!!  2023-09-06T10:04:03+00:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "FOS\ElasticaBundle\FOSElasticaBundle" now to avoid errors or add an explicit @return annotation to suppress this message.
!!  2023-09-06T10:04:03+00:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "FOS\RestBundle\FOSRestBundle" now to avoid errors or add an explicit @return annotation to suppress this message.
!!  2023-09-06T10:04:03+00:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "Nelmio\ApiDocBundle\NelmioApiDocBundle" now to avoid errors or add an explicit @return annotation to suppress this message.
!!  
Script @auto-scripts was called via post-update-cmd
~/C/t/issue-92 > main +528 -1 [!?] > php@8.2.9 > node ✘

Going to find where it comes from.

drupol commented 1 year ago

Issue has been identified.

While the message from Symfony is precise, it may present a steep learning curve for users who are not acquainted with manipulating these PSR within the Symfony framework.

In the development of ECPHP, we adopted the conscious strategy of using PSRs almost everywhere to ensure the cas-lib library could seamlessly function across different frameworks.

That said, to address your current issue, please execute the following command:

composer require ecphp/cas-bundle nyholm/psr7

You might wonder why nyholm/psr7 isn't incorporated by default in the ecphp/cas-bundle. It's a good question. Our rationale is to provide users with the flexibility to select the library that aligns best with their workflow and project requirements.

We acknowledge that recommending nyholm/psr7 might seemingly contradict the overarching goal of interoperability that PSRs advocate. This preference is primarily due to its accompanying recipe, which facilitates the automatic creation of container bindings in Symfony (by generating the config/packages/nyholm_psr7.yaml file). However, please note that you are free to establish these bindings manually with the PSR7 library that you prefer.

I believe this explanation elucidates the matter at hand, and I will be marking this issue as resolved. If you find any aspects unclear or require further assistance, do not hesitate to reopen the issue.