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.
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.
No warnings.
A warning.
Joomla 3.8.2
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.
Labels |
Added:
?
|
Category | ⇒ | com_content |
Status | New | ⇒ | Discussion |
Labels |
Added:
J3 Issue
|
Status | Discussion | ⇒ | New |
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: ? |
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