nextcloud / user_saml

:lock: App for authenticating Nextcloud users using SAML https://apps.nextcloud.com/apps/user_saml
https://portal.nextcloud.com/article/configuring-single-sign-on-10.html
GNU Affero General Public License v3.0
96 stars 76 forks source link

Running occ saml:metadata gives error #786

Closed johandalabacka closed 1 year ago

johandalabacka commented 1 year ago

Steps to reproduce

  1. Run occ saml:metadata

Expected behaviour

The metadata should be output to stdout

Actual behaviour

Metadata is outputed and also an error:

An unhandled exception has been thrown:
TypeError: Return value of "OCA\User_SAML\Command\GetMetadata::execute()" must be of the type int, "null" returned. in /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php:301
Stack trace:
#0 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#1 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#2 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#3 /var/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#4 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#5 /var/www/nextcloud/occ(11): require_once('...')

The reason for this is that /var/www/nextcloud/apps/user_saml/lib/Command/ConfigGet.php don't return a exit code. All other commands in /var/www/nextcloud/apps/user_saml/lib/Command returns something like:

class ConfigGet extends Base {

    protected function execute(InputInterface $input, OutputInterface $output): int {

        return 0; // <- like this
    }
}

Server configuration

Operating system: ubuntu 22.04 LTS

Web server: apache 2.4

Database: mariadb 10.6

PHP version: 8.1

Nextcloud version: 27.1.3

Where did you install Nextcloud from: Downloaded zip from homepage

johandalabacka commented 1 year ago

I see it is fixed in 6.0 https://github.com/nextcloud/user_saml/blob/v6.0.0/lib/Command/GetMetadata.php