No Code Attached Yet
avatar Yiannistaos
Yiannistaos
3 Jul 2024

Steps to reproduce the issue

With Joomla! CLI I'm trying to set the force_ssl to the entire site.

php cli/joomla.php config:set sef=false mailonline=false force_ssl=2 -vvv

But I get an error in administrator/components/com_config/src/Model/ApplicationModel.php line 364:

[Error] Call to undefined method Joomla\CMS\Application\ConsoleApplication::setUserState()

Expected result

Screenshot 2024-07-03 at 14 42 04

Actual result

Screenshot 2024-07-03 at 14 41 38

Comments

It works fine with any other config variables. The problem is only with force_ssl.

avatar Yiannistaos Yiannistaos - open - 3 Jul 2024
avatar joomla-cms-bot joomla-cms-bot - change - 3 Jul 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Jul 2024
avatar richard67
richard67 - comment - 7 Jul 2024

The exception happens here: https://github.com/joomla/joomla-cms/blob/5.1-dev/administrator/components/com_config/src/Model/ApplicationModel.php#L364

But the reason that the code goes into that catch block is because Uri::getInstance()->getHost() returns 'joomla.invalid' here https://github.com/joomla/joomla-cms/blob/5.1-dev/administrator/components/com_config/src/Model/ApplicationModel.php#L340 when running in the CLI, and so the later HTTP request in line 354 fails, and we end in that catchblock where the setUserState call fails.

So the question is what to do with that complete check at all when we are in the CLI.

avatar brbrbr
brbrbr - comment - 9 Jul 2024

A missing live site in the CLI might occur in more situations.

I think populateHttpHost should not set the SERVER if live_site is unset.
and Uri should throw an exception if $_SERVER['HTTP_HOST'] is unset for $uri == 'SERVER'

Enforcing users to set the live_site when ever needed.

avatar brianteeman
brianteeman - comment - 19 Nov 2024

it is NOTHING to do with live_site

Add a Comment

Login with GitHub to post a comment