Issue Description: Split Authentication State Between PHPMaker and Symfony Security
This issue usually occurs after the user logs in, after some time has passed, and after an error that happens during code development. Once that error is fixed, this problem appears...
I’m experiencing a very confusing authentication inconsistency in a hybrid system that combines PHPMaker’s internal security layer with Symfony Security (firewalls + authenticators).
Problem Summary
After a user successfully logs in, everything appears to work correctly inside the PHPMaker-generated part of the application. The session contains all expected PHPMaker-related authentication data, and the user is considered logged in.
However, as soon as I navigate to parts of the application that rely on Symfony Security, the authentication state is completely missing.
This leads to a situation where:
- In PHPMaker-controlled pages → user is logged in

- In Symfony-controlled pages → user is NOT authenticated

Security::getToken()returnsnullisGranted()returnsfalse- Symfony session security keys like
_security.maindo not exist - Only unrelated session values like
_security.last_usernameor_security.main.target_pathexist
So effectively, the system behaves as if there are two separate authentication contexts, and only one of them is active depending on the part of the system being executed.
Observed Behavior
When debugging the session, I see the following:
-
Symfony security session keys are partially present:
_security.last_username_security.main.target_path
-
But the actual security token storage is missing:
_security.main→null
-
Symfony security token is also missing:
$this->security->getToken()→null
-
Access checks fail:
isGranted()→false
Additionally, none of the expected Symfony security lifecycle events are triggered:
AuthenticationSuccessHandleris never calledAuthenticationTokenCreatedEventis never fired- Custom authenticators (
AbstractLoginFormAuthenticator) are not consistently executed or appear to be bypassed
What I Have Already Tested
I investigated the issue from multiple angles:
-
Checked Symfony firewall configuration
- Verified
mainfirewall uses a custom authenticator - Confirmed session-based firewall (
stateless: false)
- Verified
-
Debugged authentication flow
- Added dumps inside
authenticate() - Added dumps inside
onAuthenticationSuccess() - Added listeners for authentication events
- Added dumps inside
-
Inspected session state
- Confirmed
_security.mainis missing - Confirmed only partial
_security.*keys exist
- Confirmed
-
Verified security token
Security::getToken()returnsnullimmediately after login
-
Reviewed login implementation
- PHPMaker has its own login/session mechanism running in parallel
Key Suspicion
It appears that PHPMaker is managing authentication independently from Symfony Security, and Symfony is either:
- Not being fully engaged during login, or
- Losing its security token immediately after request transition, or
- Operating in a different session scope than PHPMaker’s login system
This results in a split-brain authentication state:
- PHPMaker session = authenticated user
- Symfony Security context = anonymous user
What I Need Help With
I am trying to understand:
- Why Symfony Security is not persisting the authentication token
- Whether PHPMaker session handling is bypassing or overwriting Symfony session storage
- How to properly synchronize PHPMaker authentication with Symfony firewall
- Whether a custom authenticator is being ignored or not registered correctly in the firewall lifecycle
If anyone has experience integrating PHPMaker authentication with Symfony Security, or has seen similar “half-authenticated session” behavior, I would really appreciate guidance.