PHP Warning: Trying to access array offset on false in SAMLEnvVars.php when site_url is invalid or missing
Mautic Series
7.2.x series
Mautic installed version
7.2.1
Way of installing
I downloaded a release from https://www.mautic.org/mautic-releases
PHP version
8.3.33
What browsers are you seeing the problem on?
Not relevant
What happened?
PHP Warning: Trying to access array offset on false in app/bundles/CoreBundle/Loader/EnvVars/SAMLEnvVars.php on line 16
This warning appears in the logs on every request. parse_url() can return false when site_url is malformed or not yet set during initialization.
The code at line 16 accesses $parts['host'] without checking whether parse_url() succeeded.
Expected: no warning; fall back to 'mautic' as the entity ID when parse_url() returns false.
How can we reproduce this issue?
Step 1: Install Mautic without a valid site_url configured, or with a malformed URL. Step 2: Trigger any request (web or CLI/cron). Step 3: Check PHP logs — the warning appears on every execution of SAMLEnvVars::load().
Relevant log output
[PHP Warning] Trying to access array offset on false in /var/www/html/docroot/app/bundles/CoreBundle/Loader/EnvVars/SAMLEnvVars.php on line 16Code of Conduct
- I confirm that I have read and agree to follow this project's Code of Conduct
Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.
Source: mautic/mautic