? ?
avatar mbabker
mbabker
8 Apr 2016

There are places in the CMS where error conditions are raised and those errors are silently ignored. This can result in either an API appearing to behave correctly (as was the case with JMail before 3.5.1), the API making it easier for fatal errors to occur, or making debugging error states difficult because the error condition is masked. Examples of this include the getMenu(), getPathway(), and getRouter() methods of JApplicationCms in which if an Exception is thrown when trying to retrieve these objects the error is discarded and a null value is returned instead. A downstream consumer not checking $menu === null could try to use the expected JMenu object and trigger a fatal error trying to call a method on a non-object, whereas if an exception is thrown (either from the getters or just not catch any exceptions thrown by the underlying called methods), a developer can catch an error state and act on it with debug data and if this exception goes unhandled instead of a WSOD or PHP Fatal Error you'd at least end up on Joomla's error page.

avatar mbabker mbabker - open - 8 Apr 2016
avatar brianteeman brianteeman - change - 8 Apr 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 13 Apr 2016
Category Libraries
avatar brianteeman
brianteeman - comment - 23 Aug 2016

@mbabker have your subsequent PRs closed this?

avatar mbabker
mbabker - comment - 23 Aug 2016

Nope. There are some places where it can/will be argued that removing the catch (Exception $e) { return null; } blocks in some of these methods will introduce B/C breaks so I'm not going to get into that fight until someone finally opens a 4.0 branch. Not like things can get any more broken than they are in those error conditions, but useful error messages would be nice.

avatar brianteeman brianteeman - change - 23 Aug 2016
Labels Added: ?
avatar brianteeman
brianteeman - comment - 23 Aug 2016

OK moving to Re-evaluate for v4

avatar mbabker mbabker - change - 11 Dec 2016
The description was changed
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-12-11 21:18:23
Closed_By mbabker
avatar mbabker mbabker - close - 11 Dec 2016
avatar rvbgnu
rvbgnu - comment - 6 Feb 2017

Is this very valuable improvement have been moved into J 4.0 ? I would like to follow it and help to test it, if I can.

Add a Comment

Login with GitHub to post a comment