simplesamlphp/simplesamlphp 1.17.0+ causes conflict with other login modules (Cognito)
After a recent upgrade on one of our projects, we started having an issue where this module would create a PHP session too early in the request and other modules' logic (Cognito in our case) would fail with the error "Failed to start the session: already started by PHP".
I found out that this was because of a change in the PHP library which is called from the SimplesamlphpAuthManager service's constructor while trying to create an instance.
I have created a patch where an instance is created only if one is passed in to the constructor. A method has also been added which initialises the instance on demand, and called wherever $this->instance is being called.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | simplesamlphp_auth-failed_start_session-3043942-12.patch | 1.44 KB | afireintheattic |
| 1.17.0-plus-conflict.patch | 1.94 KB | yusufhm |
Comments
Comment #2
brockfanning commentedThis patch fixes a problem we are having locally, with a "Failed to start the session: already started by PHP" error. Thank you!
I don't understand the internals enough to say what module or code we have that is causing the conflict.
Are the test failures here false alarms?
Comment #3
yusufhmComment #4
yusufhmMade the title more relevant to the error obtained.
Comment #5
justcaldwellSimilar to @brockfanning; our local instances use local login -- simplesamlphp is only active "cloud" instances. The error started popping up when a recent composer update moved us to 1.17.2. This patch fixes it. Thanks!
Comment #6
berdirCan you check if #3050273: Require SimpleSAMLphp ^1.17.2 and use namespaced class names fixes the problem as well? Then I'll close this as a duplicate, although I already suggested in #2915568: Installing the module causes exception and Drupal whitescreen to switch to a lazy load implementation similar to what was proposed here.
Comment #7
justcaldwellCan't speak to the OP's use case, but the patch at #3050273: Require SimpleSAMLphp ^1.17.2 and use namespaced class names doesn't resolve this problem for us. The "Failed to start the session: already started by PHP" error returns for local login attempts.
Comment #8
berdirAh I see, I thought it's the configuration stuff or a warning message or so, but I got it now.
Then lets do the lazy initalization here, but I'd prefer to just change $this->instance to $this->getInstance() and then initialize inside it.
Comment #9
berdir#2915568: Installing the module causes exception and Drupal whitescreen does include the same kind of lazy loading that should fix this.
Comment #10
brockfanning commentedBerdir, was that meant to be posted in another issue? The link is to here I think.
Comment #11
berdirFixed the link, sorry.
Comment #12
afireintheattic commentedThis patch worked well for me! In case anyone needs it, I'm also attaching a patch that should apply cleanly to the 3.0 release of the module as well.
UPDATE: This patch actually does not work for me any longer, but checking out the full 3.x-dev code resolves this issue completely.
Comment #13
brockfanning commentedI'm trying the latest 3.x-dev code now, without any patches, and the problem appears to be gone. @afireintheattic could you confirm?
Comment #14
afireintheattic commented@brockfanning The patch I posted above that is rolled against the 3.0 release actually does not work; however, I did checkout the 3.x-dev code and can confirm that it does indeed resolve the issue for me. This is a bit of a blocker for use, so hopefully this gets released soon! :D
Comment #15
berdirI was waiting on some confirmations that this is indeed the case as I didn't have a chance yet to test it myself. Closing as a duplicate then.
Comment #16
berdirHere we go: https://www.drupal.org/project/simplesamlphp_auth/releases/8.x-3.1