No Code Attached Yet J3 Issue
avatar Denitz
Denitz
23 Nov 2017

Sample situation:

System plugin adds model path for component1 (there are such bad approaches, e.g. in JCalPro)
Next component2 is executed with view e.g. search, usual controller tries to get this model, it's missed in component2, hence BaseDatabaseModel::getInstance() should return false.

But, component1 has model named search and BaseDatabaseModel::getInstance() logs JLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND error.

The issue is that BaseDatabaseModel::addIncludePath() always adds common path '' when any prefixed path is added, and it also searches in common path '' when any model is searched via getInstance() as fallback after failing to find model by required prefix.

As a result JLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND message can be displayed.

Steps to reproduce the issue

Add the code into index.php of your template:

JModelLegacy::getInstance('article', 'Anothercomponent');

Open any com_content page, see warning:
Model class AnothercomponentArticle not found in file.

Expected result

No warnings.

Actual result

A warning.

System information (as much as possible)

Joomla 3.8.2

Additional comments

This test replicates the possible situation: initiall com_content added own model path for 'ContentModel' prefix.

Next we can try to load model of own component, either manually or it's done automatically in BaseController.

BaseDatabaseModel doesn't have paths registered for our prefix Anothercomponent but is searches in '' paths and finds /components/com_content/models/article.php, next requires this file and raises JLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND because model class doesn't exist for sure.

I think that BaseDatabaseModel::getInstance() should not raise JLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND if $prefix was given.

Or JLog should not display application queue messages.

avatar Denitz Denitz - open - 23 Nov 2017
avatar joomla-cms-bot joomla-cms-bot - change - 23 Nov 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Nov 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 23 Nov 2017
Category com_content
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 10 Apr 2018
Status New Discussion
avatar joomla-cms-bot joomla-cms-bot - unlabeled - 10 Apr 2018
avatar brianteeman brianteeman - change - 30 Oct 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 30 Oct 2018
avatar jwaisner jwaisner - change - 18 Mar 2020
Status Discussion New
avatar brianteeman
brianteeman - comment - 23 Aug 2022

Thank you for raising this issue.

Joomla 3 is now in security only mode with no further bug fixes or new features.

As this issue doesn't relate to Joomla 4 it will now been closed.

If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4.
cc @zero-24

avatar zero-24 zero-24 - change - 23 Aug 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-08-23 13:47:22
Closed_By zero-24
Labels Added: No Code Attached Yet
Removed: ?
avatar zero-24 zero-24 - close - 23 Aug 2022

Add a Comment

Login with GitHub to post a comment