User tests: Successful: Unsuccessful:
This PR is for issue #4140
Function declaration states that you can pass an array of paths to the addIncludePath
:
/**
* Add a directory where JModelLegacy should search for models. You may
* either pass a string or an array of directories.
*
* @param mixed $path A path or array[sting] of paths to search.
* @param string $prefix A prefix for models.
*
* @return array An array with directory elements. If prefix is equal to '', all directories are returned.
*
* @since 12.2
*/
https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/model/legacy.php#L76
But that's false. If you try to use it like:
JModelLegacy::addIncludePath(
array(
JPATH_ADMINISTRATOR . '/components/com_content/models',
JPATH_SITE . '/components/com_content/models'
)
);
You will get a nice error caused because JPath expects to receive a string:
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/filesystem/path.php#L199
And we are passing it the array:
https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/model/legacy.php#L108
Not time to dig into it. I just wanted to report it before forgetting it
Labels |
Added:
?
|
Category | ⇒ | Libraries |
Title |
|
Title |
|
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-08-21 13:17:31 |
Closed_By | ⇒ | roland-d |
Milestone |
Added: |
First , I paste the example code which is written by you to getItems method in category.php . Then in frontend , I clicked the article category list and got the error .
After that I tried your code via patch tester .When I cliked the article category list , I didn't get the error . It worked !
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4729.