? ? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
19 Jan 2021

Pull Request for Issue #31984 .

Summary of Changes

handled exception from CLI

Testing Instructions

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

Actual result BEFORE applying this Pull Request

image

Expected result AFTER applying this Pull Request

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

avatar alikon alikon - open - 19 Jan 2021
avatar alikon alikon - change - 19 Jan 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Jan 2021
Category CLI
5a02415 19 Jan 2021 avatar alikon cs
avatar alikon alikon - change - 19 Jan 2021
Labels Added: ?
avatar toivo toivo - test_item - 19 Jan 2021 - Tested successfully
avatar toivo
toivo - comment - 19 Jan 2021

I have tested this item successfully on 5a02415

Tested successfully in Beta7-dev of 19 January using PHP 8.0.1.


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

avatar gostn gostn - test_item - 20 Jan 2021 - Tested successfully
avatar gostn
gostn - comment - 20 Jan 2021

I have tested this item successfully on 5a02415


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

avatar alikon alikon - change - 20 Jan 2021
Status Pending Ready to Commit
avatar alikon
alikon - comment - 20 Jan 2021

RTC


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

avatar mtbraoblkler
mtbraoblkler - comment - 20 Jan 2021

I get error handling is hard for some of y’all, but this is just a garbage hack that makes debugging errors next to impossible, might as well just print “LOLZ IT BROKE”.

Don’t merge this mess, do it right. Overload the exception handling of the console application’s execute method and tweak it to do whatever you want. There is a reason exception handling is done inside the application and not left to be handled in front controllers or entry point files, you have the entire app framework at your disposal inside the app (which, BTW, with the default application workflow means someone can add meaningful exception logging and dispatch events that can be subscribed to which allows add-on integrations to do something meaningful with errors; shocking, I know, who woulda thought you could allow add-one to do useful things in an application intended to be extended with add-one) whereas with this patch you have no way of debugging because the entire exception is swallowed.

Also, generally if there’s an uncaught exception in the exception handling layer, you typically want a noisy output in the CLI integration, as that generally means something is catastrophically broken and needs attention 10 minutes ago. This patch silences that with zero gain.

avatar alikon
alikon - comment - 20 Jan 2021

@mtbraoblkler if you are fully right then simply submit a PR....

avatar brianteeman
brianteeman - comment - 20 Jan 2021

@alikon I think you didnt realise who is behind the fake account

avatar alikon
alikon - comment - 20 Jan 2021

@brianteeman no i don't know... but doesn't matter ?

avatar wilsonge
wilsonge - comment - 1 Feb 2021

Unfortunately @mtbraoblkler is correct. This should be overloaded in our ConsoleApplication. I think https://github.com/joomla-framework/console/blob/master/src/Application.php#L914-L943 is the method you want to duplicate in the CMS ConsoleApplication class

avatar wilsonge wilsonge - change - 1 Feb 2021
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2021-02-01 20:56:59
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 1 Feb 2021

Add a Comment

Login with GitHub to post a comment