When passed paths that already exist in the $_includePaths array, JTable::addIncludePath mistakenly re-adds them. This is due to the fact that before !in_array($path, self::$_includePaths) runs, $path is converted to an array. This was to facilitate the ability to pass either an array of paths or a path string to the method. However, it also caused the in_array function to check $_includePaths as a multi-dimensional array, when it is only ever a single-dimensional array. This code fixes that behavior. I've included tests as well.
As you can probably tell, this is the actual commit - dongilbert@0f9aefd
I'm not sure how my staging branch (which I branched from) get's behind. Should I git pull upstream staging into my staging branch before I checkout / create a new branch for editing?
git pull upstream staging
So what I do in this sort of situation is:
$ git checkout origin jtablefix
$ git pull --rebase upstream staging
$ git push -f origin jtablefix
That makes sure you are on the correct branch, rebased your changes in the correct branch on top of the upstream staging branch, and then force pushes the result up to GitHub. Your mileage may vary, but try that.
Note: I'm closing this pull request for now until the requested changes are uploaded. Please leave a comment asking to reopen the pull request at that time so we can review it again. Thanks.
fixing JTable::addIncludePaths and updating unit tests
@LouisLandry - since this was a closed pull request, I didn't see the changes take effect in my commit log above. I thought something might have been broke w/github, and submitted another PR instead to see if it would update this one, but it obviously didn't. I'll know next time to simply request the PR be reopened so that I can see the changes and make sure it updated correctly. Oh well.
That said, the new PR with the correct commit is here - #1610
So, I think it would be good to document the new joomla-jenkins bot that reopens pull requests when a comment is made. I'll close PR #1610
So, I'm merging this, but the addIncludePath method really shouldn't be used any longer. It would be much better to use the autoloader for making sure that classes are available. The addIncludePath methods in JTable, JModel, etc, etc, were implemented before we had real autoloading available as an option.