composer_manager + PHP 8.2 issues

Created on 6 August 2024, 5 months ago
Updated 7 August 2024, 5 months ago

Problem/Motivation

We have a D7 site that needs to be upgraded to PHP 8.2 by Oct 31, 2024. We are currently using simplesamlphp_auth for saml authentication, but that module and its library have no PHP 8 version.

I see that this module and the php-saml toolkit ver 4 works with PHP 8. https://github.com/SAML-Toolkits/php-saml/tree/4.0.0

I have tried to use composer_manager ( https://www.drupal.org/project/composer_manager β†’ ) to install the library, but I can't get that working. I have composer and drush installed on my local machine, and I am running the commands in the docroot directory.

Any help with this is much appreciated.

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States thalemn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @thalemn
  • πŸ‡³πŸ‡±Netherlands roderik Amsterdam,NL / Budapest,HU

    I think it's time to ignore the README in this module, and ignore composer_manager.

    I'm not super experienced with Drupal 7 + composer / have only used composer_manager once, years ago... but just tried following the installation instructions, and something is completely unusable. Probably some bridge code between composer(manager) + drush, probably because it doesn't work with PHP8.2.

    I believe most people who use composer libraries with Drupal 7, install/update them manually, independently of Drupal (just using composer), and then add just one line to the index.php:

    /**
     * Root directory of Drupal installation.
     */
    define('DRUPAL_ROOT', getcwd());
    
    require_once DRUPAL_ROOT . '/../vendor/autoload.php'; /////// <- this one
    
    require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    menu_execute_active_handler();
    

    The above example is when you ran composer require onelogin/php-saml:~3 outside of the public HTML directory, i.e. your vendor/ is at the same level of your 'web/' directory. It is possible, though a little less recommended, to put vendor/ inside the "web" directory - then remove a "../" from the path.

    Feel free to post updates. I still have a soft spot for D7, though I hardly maintained the D7 module. (Only released a new version in 2021/2022 after the original maintainer had left.) I see the 7.x-1.x-dev version contains a fix and two extra features that I never tagged a release for, and there are two extra features (tagged needs work) still in the queue β†’ .

  • πŸ‡³πŸ‡±Netherlands roderik Amsterdam,NL / Budapest,HU

    For completeness: this means there's no need to install composer_manager (and/or whatever other stuff that 'drush composer-manager' tries to download).

  • πŸ‡³πŸ‡±Netherlands roderik Amsterdam,NL / Budapest,HU

    And I see the composer.json from the D7 version requires / has only been tested with onelogin/php-saml version ~3 whereas you probably need version ~4 (or ^4, no practical difference).

    I do not expect any compatibility issues between those versions.

  • πŸ‡ΊπŸ‡ΈUnited States thalemn

    Thanks @roderik. Actually I did finally arrive at your suggestions, and I updated the composer.json file to use version 4. Now it's recognizing that the library is there, all I need to do is configure the module settings with my certs, etc.

Production build 0.71.5 2024