host_variants icon indicating copy to clipboard operation
host_variants copied to clipboard

Remove CLI environment check

Open alexanderschnitzler opened this issue 2 years ago • 2 comments

Removes the early return when in CLI context. Background: When in CLI context, e.g. when sending fluid emails with absolute uri's, we can fake the HTTP_HOST by adding it to the cli call: HTTP_HOST=domain.tld REQUEST_URI=/ php vendor/bin/typo3 my:command

It's a workaround but I need this and this early returns prevents matching the host which then prevents finding the base urls which then prevents creating absolute uris.

alexanderschnitzler avatar Jun 21 '23 12:06 alexanderschnitzler

Thanks for the PR. So I guess we should rather check if we have a HTTP_HOST set?

bmack avatar Jun 21 '23 12:06 bmack

I am not sure if it actually matters if a host is set.

GeneralUtility::getIndpEnv('HTTP_HOST')

returns an empty string if it's not set in $_SERVER and the comparison returns false then. Do we need an early return and skip the comparion at all?

alexanderschnitzler avatar Jun 21 '23 14:06 alexanderschnitzler

Hi,

any opinion on this one? I have this running in a prod site for months now and don't see any issues with it.

alexanderschnitzler avatar Oct 31 '24 08:10 alexanderschnitzler

HI, Alex. I have alook today at your two MRs and test this again, I think we had an issue with this in CLI, but maybe in one of the older TYPO3 version. Maybe we remove the check and drop support for v9 and v10 in a new release, so I can test it in v11, v12 and v13.

ervaude avatar Oct 31 '24 09:10 ervaude

Thanks for the MR, I tested it and released a new version for TYPO3 11-13

ervaude avatar Nov 01 '24 09:11 ervaude