No Code Attached Yet
avatar PhilETaylor
PhilETaylor
10 Jan 2021

Steps to reproduce the issue

Install Joomla 4 perfectly.
Edit /configuration.php and change your database host to an invalid value, while there check debug=false and error_reporting = none (it would have been default).

Now run php cli/joomla.php

Expected result

Exception is caught and rendered nicely with the message "Could not connect to database: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known""
Expect no stack trace
Expect no debug information

Actual result

Joomla\Database\Exception\ConnectionFailureException^ {#196
  #message: "Could not connect to database: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known"
  #code: 2002
  #file: "/Users/phil/Sites/JOOMLA/joomla4/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php"
  #line: 280
  trace: {
    /Users/phil/Sites/JOOMLA/joomla4/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:280 { …}
    /Users/phil/Sites/JOOMLA/joomla4/libraries/vendor/joomla/database/src/DatabaseDriver.php:1846 { …}
    /Users/phil/Sites/JOOMLA/joomla4/libraries/src/Access/Access.php:1017 {
      Joomla\CMS\Access\Access::getAuthorisedViewLevels($userId)^
      › // Set the query for execution.
      › $db->setQuery($query);
      ›
      arguments: {
        $query: Joomla\Database\Mysqli\MysqliQuery {#192 …}
      }
    }
    /Users/phil/Sites/JOOMLA/joomla4/libraries/src/User/User.php:449 { …}
    /Users/phil/Sites/JOOMLA/joomla4/libraries/src/Plugin/PluginHelper.php:264 { …}
    /Users/phil/Sites/JOOMLA/joomla4/libraries/src/Plugin/PluginHelper.php:186 { …}
    /Users/phil/Sites/JOOMLA/joomla4/libraries/src/Application/ConsoleApplication.php:222 { …}
    /Users/phil/Sites/JOOMLA/joomla4/cli/joomla.php:69 { …}
  }
}

Screenshot 2021-01-10 at 16 59 25

System information (as much as possible)

independant of platform.

Bonus

if debug = true in Joomla Global Configuration then I would expect the stack trace, or more information.

if -vvv was used at the command php cli/joomla.php -vvv then I would expect the stack trace, or more information.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar PhilETaylor PhilETaylor - open - 10 Jan 2021
avatar joomla-cms-bot joomla-cms-bot - change - 10 Jan 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Jan 2021
avatar PhilETaylor PhilETaylor - change - 10 Jan 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 10 Jan 2021
avatar alikon
alikon - comment - 19 Jan 2021

please test #32082

avatar alikon alikon - change - 19 Jan 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-01-19 10:11:07
Closed_By alikon
avatar alikon alikon - close - 19 Jan 2021
avatar wilsonge wilsonge - change - 1 Feb 2021
Status Closed New
Closed_Date 2021-01-19 10:11:07
Closed_By alikon
avatar wilsonge wilsonge - reopen - 1 Feb 2021
avatar wilsonge
wilsonge - comment - 20 Feb 2021

I spent some time on this. First of all the majority of exceptions in the Applications error handler exceptions are handled correctly per https://github.com/joomla-framework/console/blob/master/src/Application.php#L424-L441

Actually the only Exceptions which aren't handled correctly are those thrown outside of the main Application execute method and then fall back to the Symfony global error handler. And in this case the CliErrorRenderer https://github.com/symfony/error-handler/blob/5.x/ErrorRenderer/CliErrorRenderer.php doesn't use the same debug flag the HtmlErrorRenderer uses... So if this is going to be fixed a patch needs to go upstream.

avatar babakhakimi
babakhakimi - comment - 16 Jan 2022

i have this issue too on fresh joomla
but my error is
"Could not connect to database: No such file or directory"


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31984.

avatar PhilETaylor
PhilETaylor - comment - 16 Jan 2022

"Could not connect to database: No such file or directory"

this is probably unrelated to this issue. That's a generic message that states your DB credentials in /configuration.php are incorrect. Ensure they are correct or replace them with working credentials that you create for your db from scratch.

Support should be gained from https://forum.joomla.org, not GitHub which is for genuine bugs.

avatar babakhakimi
babakhakimi - comment - 17 Jan 2022

thank you

i change $host in my configuration from localhost to 127.0.0.1
and its ok now


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31984.

avatar PhilETaylor PhilETaylor - change - 7 Mar 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-03-07 18:38:41
Closed_By PhilETaylor
Labels Added: No Code Attached Yet
Removed: ?
avatar PhilETaylor PhilETaylor - close - 7 Mar 2022

Add a Comment

Login with GitHub to post a comment