User tests: Successful: Unsuccessful:
Currently, the language file lib_joomla.ini contains several strings which reference a PHP method. There are several issues with that:
Classname: :Functionname
(with a space between the : :). This isn't how a method is properly written.I've started with the GET_NAME strings:
JLIB_APPLICATION_ERROR_APPLICATION_GET_NAME="JApplication: :getName() : Can't get or parse class name."
JLIB_APPLICATION_ERROR_CONTROLLER_GET_NAME="JController: :getName() : Can't get or parse class name."
JLIB_APPLICATION_ERROR_MODEL_GET_NAME="JModel: :getName() : Can't get or parse class name."
JLIB_APPLICATION_ERROR_VIEW_GET_NAME="JView: :getName() : Can't get or parse class name."
I have replaced them with a new generic one:
JLIB_APPLICATION_ERROR_GET_NAME="%s: Can't get or parse class name."
I've changed all calling places so the current method name (__METHOD__
) is passed as a variable.
JLIB_APPLICATION_ERROR_APPLICATION_GET_NAME actually wasn't used anymore.
I also removed the string JLIB_APPLICATION_ERROR_VIEW_GET_NAME_SUBSTRING which also isn't used anymore in J4.
This should work with code review as there actually should be no way with a properly written extension to trigger this error.
If someone knows how to trigger the error, feel free to share.
Error message would be for example
JController: :getName() : Can't get or parse class name.
Error message would be for example
Joomla\CMS\MVC\Controller\FormController::__construct: Can't get or parse class name.
None
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Language & Strings Libraries |
Other than thinking it might be better as JLIB_APPLICATION_ERROR_GET_NAME ie remove the word GENERIC it all seems a good idea to me
Labels |
Added:
?
?
|
You're right, the GENERIC part isn't really needed. I've changed it.
I have tested this item
I applied the patch and looked through the code and it looks good. I also inserted a simple call to enqueueMessage and (separately) to throw new exception in the article display HtmlView.php file. That gave the expected behaviour - a warning message and a fatal error message.
Code $app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_GET_NAME', __METHOD__), 'warning');
Result Joomla\Component\Content\Site\View\Article\HtmlView::display: Can't get or parse class name.
Code throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_GET_NAME', __METHOD__), 500);
Result 500 Joomla\Component\Content\Site\View\Article\HtmlView::display: Can't get or parse class name.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-11-24 02:47:43 |
Closed_By | ⇒ | wilsonge |
LGTM Thanks!
@HLeithner Yes it is, and an allowed one for J4.0.
If this PR is accepted, I will do more of the same kind with other instances of the same issue.