Fatal Error on Shibboleth Registration

Describe the issue or problem
Trying to register from the Shibboleth Plugin fails with a 500 error.

Steps I took leading up to the issue

  1. Install and configure the Shibboleth plugin
  2. Try to register via Institutional Login

What application are you using?
OJS 3.3.0-13

Additional information
Snippet from the error log:

PHP Fatal error: Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'username' at row 1 in /var/www/html/ojs-3.3.0-13/lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:115\nStack trace:\n#0 /var/www/html/ojs-3.3.0-13/lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(115): PDOStatement->execute()\n#1 /var/www/html/ojs-3.3.0-13/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Connection.php(489): Doctrine\\DBAL\\Driver\\PDOStatement->execute()\n#2

Steps I took to investigate the issue
After digging through the code I suspect the problem lies within the ShibbolethHandler.inc.php, line 555:

It seems like the userEmail is simply assigned here to the username without any further formatting. However, the character_maximum_length of the username is 32 and furthermore only alphanumeric characters are allowed.

Any help is appreciated!


I was able to confirm that the problem is said assignment $user->setUsername($userEmail);.
Setting the user to a string that fits the username criteria ($user->setUsername("testuser123");) resulted in successful registration.

Opened a GitHub issue for this topic: Registration fails when email is assigned as username · Issue #21 · pkp/shibboleth · GitHub