moodle-auth_saml2
moodle-auth_saml2 copied to clipboard
Issue with PHP8.3 and Moodle 4.4
What happened? The server returns 500 when logging in to moodle with SAML2
Please provide as many of the following as applies:
With debugging enable, this is shown in apache2's error.log
- stacktrace of the error
- screen shots
- a dump of the error log with both moodle debugging on full and saml debugging on as well
[Thu May 02 11:38:37.342616 2024] [php:notice] [pid 1109] [client 10.3.2.10:42438] %date{%b %d %H:%M:%S} 10.3.2.10 SimpleSAMLphp DEBUG [76f0aa3876] Session: Valid session found with 'example.com'., referer: https://example.com/login/index.php
[Thu May 02 11:38:37.344557 2024] [php:notice] [pid 1109] [client 10.3.2.10:42438] auth_saml2: saml_login_complete found user siwat.s, referer: https://example.com/login/index.php
[Thu May 02 11:38:37.345877 2024] [php:error] [pid 1109] [client 10.3.2.10:42438] PHP Fatal error: Declaration of DI\\Container::get(string $id): mixed must be compatible with Psr\\Container\\ContainerInterface::get($id) in /var/www/moodle/lib/php-di/php-di/src/Container.php on line 124, referer: https://example.com/login/index.php
I tried https://example.com/auth/saml2/test.php and it works fine
PS: I replace the actual domain with example.com What you expected: Could this be an issue with version mismatch?
Hello, the fatal error suggest the issue is in Moodle:
PHP Fatal error: Declaration of DI\\Container::get(string $id): mixed must be compatible with Psr\\Container\\ContainerInterface::get($id) in /var/www/moodle/lib/php-di/php-di/src/Container.php on line 124, referer: https://example.com/login/index.php
But it would probably be noticed already many times. Do you have something unique at your setup apart of Moodle and SAML2? I have a feeling that somehow Psr\\Container\\ContainerInterface
namespace points to a different copy of Container at your case (not at lib/psr/container/src/ContainerInterface.php
which declaration matches implemetation).
Hi, thanks for reading.
This is a fresh installation of moodle 4.4, the only plugin it have is SAML2
It is installed on Ubuntu 22.04 with PHP8.3 and apache2.
Hello, suffering the same problem here and test.php works as well. Interestingly, if dual authentication methods are enabled (such as saml2 and manual accounts) not even the manual accounts login prompt appears, I receive a 500 error instead
I am also using this version with Moodle 4.4, but with PHP 8.2.18. The plugin works for the most part, but it does not redirect properly. I can't say for sure, but it may be in classes/auth.php line 814 that does not complete as expected. I just get a white page, but if I put in my desired url after authentication, I am logged in. This plugin worked flawlessly on 4.3, but the php version was 7.4.
I can confirm that PR #812 appears to fix the problems seen in 4.4.
I can confirm that PR #812 appears to fix the problems seen in 4.4.
Upgrading to PR #812 does indeed works.