Difficulties upgrading to 9.5.9 due to the laminas-diactoros change

Created on 4 May 2023, over 1 year ago
Updated 1 August 2023, over 1 year ago

Upgrade to 9.5.9 via composer throws this error and gives a black screen unaccessible site A rollback is necessary

It appears laminas is to blame in some way

[root@main public_html]# drush cache:rebuild
PHP Warning: require(/var/www/public_html/vendor/composer/../laminas/laminas-diactoros/src/functions/create_uploaded_file.php): Failed to open stream: No such file or directory in /var/www/public_html/vendor/composer/autoload_real.php on line 45
PHP Fatal error: Uncaught Error: Failed opening required '/var/www/public_html/vendor/composer/../laminas/laminas-diactoros/src/functions/create_uploaded_file.php' (include_path='/var/www/public_html/vendor/pear/archive_tar:/var/www/public_html/vendor/pear/console_getopt:/var/www/public_html/vendor/pear/pear-core-minimal/src:/var/www/public_html/vendor/pear/pear_exception:.:/usr/share/pear:/usr/share/php:/usr/share/pear:/usr/share/php') in /var/www/public_html/vendor/composer/autoload_real.php:45
Stack trace:
#0 /var/www/public_html/vendor/composer/autoload_real.php(49): {closure}('07d7f1a47144818...', '/var/www/bigbay...')
#1 /var/www/public_html/vendor/autoload.php(25): ComposerAutoloaderInitf197092365111500249304d9be7b237b::getLoader()
#2 /var/www/public_html/vendor/drush/drush/drush.php(56): include_once('/var/www/...')
#3 /var/www/public_html/vendor/drush/drush/includes/preflight.inc(18): require('/var/www/...')
#4 phar:///usr/bin/drush/bin/drush.php(143): drush_main()
#5 /usr/bin/drush(14): require('phar:///usr/bin...')
#6 {main}
thrown in /var/www/public_html/vendor/composer/autoload_real.php on line 45
[root@main public_html]#

📌 Task
Status

Active

Version

9.5

Component
Base 

Last updated about 5 hours ago

Created by

🇺🇸United States bobburns

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

Comments & Activities

  • Issue created by @bobburns
  • Status changed to Postponed: needs info over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    How did you perform the upgrade? With composer or using the tarball

  • 🇺🇸United States bobburns

    Upgrade to 9.5.9 via composer throws this error and gives a black screen unaccessible site A rollback is necessary

    Is the first line of the issue - composer

    "drupal/core": "9.5.9",
    "drupal/core-composer-scaffold": "9.5.9",
    "drupal/core-project-message": "9.5.9",
    "drupal/core-recommended": "9.5.9",

    Have been doing this since version 8

  • I don't know if it is an issue with this specific site, but drupal/core should not be there if drupal/core-recommended is there. It's a bit unusual to see both.

    What specific Composer commands did you type?

  • Also: I cannot reproduce this at all.

  • 🇺🇸United States bobburns

    What is causing it looks like => longwave/laminas-diactoros (2.14.2) appears to be installed and it reports Removing laminas/laminas-diactoros (2.14.0). When laminas/laminas-diactoros (2.14.0) is left there and core is manually put on it works.

    The original composer json fle was copied from an installing Drupal page and I do not know what difference there is between "core" and "core-recommended" but it has always worked

    I am going to leave it alone working until the next upgrade is released and then we will see if the issue is still there

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    The laminas package has a security issue.
    The fork into longwave's namespace is to backport the security fix

  • I've observed the same site crash after composer update.
    The error I've had (in console) is:

    Gathering patches for dependencies. This might take a minute.
    - Installing drupal/core (9.5.9): Extracting archive
    Failed to extract drupal/core: (50) C:\Programs\common\msys\bin\unzip.EXE -qq C:\Data\webdev\drupalProjects\plateformeauto_v1_dev\vendor\composer\tmp-08c96cd58904700324fdc67b735b381e -d C:\Data\webdev\drupalProjects\plateformeauto_v1_dev\vendor\composer\f385dedc

    error: cannot create C:/.../vendor/composer/f385dedc/drupal-core-c3b194f/modules/content_moderation/tests/modules/content_moderation_test_views/config/install/views.view.test_content_moderation_state_filter_base_table_filter_group_or.yml
    error: cannot create C:/.../vendor/composer/f385dedc/drupal-core-c3b194f/modules/content_moderation/tests/modules/content_moderation_test_views/config/install/views.view.test_content_moderation_state_filter_base_table_filter_on_revision.yml

    The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
    Unzip with unzip command failed, falling back to ZipArchive class

    I checked that both yml files were correctly created but I didn't have time to check the archive and be able to know if it contains identical file names with different capitalization (which fails on case insensitive filesystems)
    I'm on a windows OS.
    Kind regards,
    Vlad

  • @valica Your error seems totally different. What is the connection to this support request?

  • The error I've posted is still related to the update to Drupal Core 9.5.9. Moreover, once the installation goes wrong, the rollback take long time to finish and it happened to fail. At that stage, when testing the website, I saw laminas errors.
    I didn't have time to get more into details but I consider that any additional information might be helpful.
    In my case, I simply typed "composer update" to get into the problem.
    HTH,
    valica

  • 🇺🇸United States glynster

    We have a similar issue:

    Composer require:

    "drupal/core-composer-scaffold": "^9.5",
            "drupal/core-project-message": "^9.5",
            "drupal/core-recommended": "^9.5",
            "drupal/core-vendor-hardening": "^9.5",

    Run composer update

    Read out:

    Updating dependencies
    Lock file operations: 1 install, 2 updates, 1 removal
      - Removing laminas/laminas-diactoros (2.14.0)
      - Upgrading drupal/core (9.5.8 => 9.5.9)
      - Upgrading drupal/core-recommended (9.5.8 => 9.5.9)
      - Locking longwave/laminas-diactoros (2.14.2)
    Installing dependencies from lock file (including require-dev)
    Package operations: 1 install, 2 updates, 1 removal
      - Removing laminas/laminas-diactoros (2.14.0)
    Gathering patches for dependencies. This might take a minute.
      - Installing longwave/laminas-diactoros (2.14.2): Extracting archive
      - Upgrading drupal/core (9.5.8 => 9.5.9): Extracting archive
      - Upgrading drupal/core-recommended (9.5.8 => 9.5.9)
    

    Run composer cr

    After this we always get the following error:

    The website encountered an unexpected error. Please try again later.
    Error: Class "Laminas\Diactoros\ServerRequestFactory" not found in Drupal\Component\DependencyInjection\Container->createService() (line 259 of core/lib/Drupal/Component/DependencyInjection/Container.php).

    As soon as we revert composer require drupal/core-recommended:9.5.8 --update-with-all-dependencies

    All works as usual.

  • 🇺🇸United States stephenplatz

    I had the exact same error as the one reported by @/bobburns. Removing the vendor directory and running composer install fixed the issue for me.

  • 🇺🇸United States glynster

    @stephenplatz I was hoping this would help but no luck in our case....Ee will hold off upgrading until the next update and hopefully this gets solved!

  • 🇳🇱Netherlands ReneW

    I had the same issue over here. Nothing worked. Because the website was running on an acceptance environment on shared hosting, I logged in into DirectAdmin and under PHP-settings disabled and enabled the 'Opcache' checkbox. That fixed the problem for me!

  • 🇺🇸United States glynster

    @ReneW spot on. For me this was happening locally. Once we performaced a lando rebuild to clear the php caching all was resolved. So given everyones issues I think it's fair to say this is a PHP caching issue.

  • 🇺🇸United States stephenplatz

    Rebuilding my app with lando was not a solution for me, composer and drush still failed with the exact error above

    PHP Fatal error: Uncaught Error: Failed opening required '/var/www/public_html/vendor/composer/../laminas/laminas-diactoros/src/functions/create_uploaded_file.php' (include_path='/var/www/public_html/vendor/pear/archive_tar:/var/www/public_html/vendor/pear/console_getopt:/var/www/public_html/vendor/pear/pear-core-minimal/src:/var/www/public_html/vendor/pear/pear_exception:.:/usr/share/pear:/usr/share/php:/usr/share/pear:/usr/share/php') in /var/www/public_html/vendor/composer/autoload_real.php:45

    That doesn't rule-out caching somewhere as the underlying issue, but it also seems like there are several discrete issues being reported here, mine was the exact same as the original reported issue.

  • 🇺🇸United States glynster

    @stephenplatz interesting. I also run many websites on Drupal 8/9/10 using Lando and this was the first time this had occurred. It is hard when everything is just a little different for everyone. I guess all we can do is keep adding our outcomes here to help others.

  • I have the same issue with one of my clients. It is the same for laminas-diactoros when I upgrade to Drupal core 9.5.9 with this error:
    Warning: require(/code/vendor/composer/../laminas/laminas-diactoros/src/functions/create_uploaded_file.php): failed to open stream: No such file or directory in /code/vendor/composer/autoload_real.php on line 45 Fatal error: require(): Failed opening required '/code/vendor/composer/../laminas/laminas-diactoros/src/functions/create_uploaded_file.php' (include_path='/code/vendor/pear/archive_tar:/code/vendor/pear/console_getopt:/code/vendor/pear/pear-core-minimal/src:/code/vendor/pear/pear_exception:.:/usr/share/pear:/usr/share/php') in /code/vendor/composer/autoload_real.php on line 45

    Nothing from the suggestion above seems to work. I'm keeping on deep diving to see if I hit some light but it would be lovely to know your ideas on this.

  • Same situation as #19, anyone has a solution ?

  • Status changed to Active over 1 year ago
  • 🇬🇧United Kingdom catch

    I don't know if there's anything we can do in core about this, but I think at least we could put some of the known workarounds into the 9.5.9 release notes.

  • 🇳🇱Netherlands spokje

    Does something like composer dump-autoload or even the drastic combo rm -rf vendor && composer install change anything?

  • 🇬🇧United Kingdom longwave UK

    Yeah this feels like one of the autoloader optimizations is being cached somewhere - https://getcomposer.org/doc/articles/autoloader-optimization.md has a bit more info on this, the "dump-autoload" above is a good idea, and it's possible that the incorrect optimisations are being stored in APCu so restarting your webserver might be an option, if possible.

  • 🇺🇸United States seanr

    I'm stuck with a completely unusable composer - I can't even run `dump-autoload`. Is there a way to do that manually?

  • 🇮🇳India Jeya sundhar Coimbatore

    Hi @longwave Thankyou. After composer update. I reboot the aws server. It's now updated to 9.5.8 ~> 9.5.10

  • 🇵🇱Poland sandboxpl Poland 🇵🇱

    We experience same problem , after deploying changes the website goes down and we get following error:
    Error: Class "Laminas\Diactoros\ServerRequestFactory" not found in /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 #0 /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(449): Drupal\Component\DependencyInjection\Container->createService(Array, 'private__Q1ZW9d...')
    restarting FPM pool and clearing op/apcu cache solves the problem,
    it seems that it comes down to the change introduced in core 9.5.9 and following issue:
    https://www.drupal.org/project/drupal/issues/3356283 📌 Fork laminas/laminas-diactoros Fixed
    The fork of laminas/laminas-diactoros packange moved the vendor package around in vendor directories
    vendor/laminas/laminas-diactoros -> vendor/longwave/laminas-diactoros
    Usually setting new deployment_identifier helps us to get around such problems, but in this case it didn't work

  • 🇵🇱Poland sandboxpl Poland 🇵🇱
  • First commit to issue fork.
Production build 0.71.5 2024