glpi-project/glpi

GLPI 11 : bin/console marketplace:download crash when closing unopened session

Closed this issue · 1 comments

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

11.0.0-rc5

Bug description

When running:

php bin/console marketplace:download --verbose news

This error occurs:

In SessionException.php line 9:

  [Safe\Exceptions\SessionException]
  An error occurred

Relevant log output

In SessionException.php line 9:

  [Safe\Exceptions\SessionException]
  An error occurred


Exception trace:
  at /var/www/glpi/vendor/thecodingmachine/safe/generated/Exceptions/SessionException.php:9
 Safe\Exceptions\SessionException::createFromPhpError() at /var/www/glpi/vendor/thecodingmachine/safe/generated/8.4/session.php:540
 Safe\session_write_close() at /var/www/glpi/src/Glpi/Marketplace/Api/Plugins.php:438
 Glpi\Marketplace\Api\Plugins->downloadArchive() at /var/www/glpi/src/Glpi/Marketplace/Controller.php:201
 Glpi\Marketplace\Controller->downloadPlugin() at /var/www/glpi/src/Glpi/Console/Marketplace/DownloadCommand.php:98
 Glpi\Console\Marketplace\DownloadCommand->execute() at /var/www/glpi/vendor/symfony/console/Command/Command.php:326
 Symfony\Component\Console\Command\Command->run() at /var/www/glpi/vendor/symfony/console/Application.php:1096
 Symfony\Component\Console\Application->doRunCommand() at /var/www/glpi/src/Glpi/Console/Application.php:320
 Glpi\Console\Application->doRunCommand() at /var/www/glpi/vendor/symfony/console/Application.php:324
 Symfony\Component\Console\Application->doRun() at /var/www/glpi/vendor/symfony/console/Application.php:175
 Symfony\Component\Console\Application->run() at /var/www/glpi/bin/console:144

Page URL

No response

Steps To reproduce

run in GLPI docker Container (glpi/glpi:11.0.0-rc5) :

docker compose exec --user=www-data glpi php bin/console marketplace:download --verbose news

Your GLPI setup information

No response

Anything else?

The issue occurs from calling session_write_close() with no session started in src/Glpi/Marketplace/Api/Plugins.php line 438, in downloadArchive() method.

I've fixed this by adding a check if the session exist:

if(session_status() === PHP_SESSION_ACTIVE) {
  session_write_close();
}

I confirm the issue