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
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
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 { …}
}
}
independant of platform.
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.
Labels |
Added:
?
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-01-19 10:11:07 |
Closed_By | ⇒ | alikon |
Status | Closed | ⇒ | New |
Closed_Date | 2021-01-19 10:11:07 | ⇒ | |
Closed_By | alikon | ⇒ |
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.
i have this issue too on fresh joomla
but my error is
"Could not connect to database: No such file or directory"
"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.
thank you
i change $host in my configuration from localhost to 127.0.0.1
and its ok now
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: ? |
please test #32082