?
avatar nsrsr
nsrsr
5 Apr 2016

Steps to reproduce the issue

  1. Connect to another database $db = JDatabaseDriver::getInstance($databaseOptions);
  2. use this $db object to get a JTable instance $contentTable = JTable::getInstance('content', 'JTable', array('dbo' => $db));
  3. JTable::getInstance will not use $db as specified, but default database

Expected result

Use specified database

Actual result

JTable Uses same database as in /configuration.php

FIX

look for JTableContent (libraries/legacy/table/content.php) line
// Verify that the alias is unique

//$table = JTable::getInstance('Content', 'JTable', array('dbo',$this->getDbo())); //incorrect
$table = JTable::getInstance('Content', 'JTable', array('dbo'=>$this->getDbo())); //correct

Do a search for 'dbo',$this->getDbo() to find possibly more occurences of this bug which are JTableMenuType,JTableNested, JTableLanguage

System information (as much as possible)

Joomla 3.5

Additional comments

excerpt from JTable::getInstance:
$db = isset($config['dbo']) ? $config['dbo'] : JFactory::getDbo(); //assoziative array syntax
bug is obvious, isn't it?

avatar nsrsr nsrsr - open - 5 Apr 2016
avatar nsrsr nsrsr - change - 5 Apr 2016
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 5 Apr 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 5 Apr 2016
Category Libraries
avatar nsrsr
nsrsr - comment - 9 Apr 2016

Can anyone comment this really is a bug or a misunderstanding by myself? I need to inform my customers if this will be fixed in any upcoming release. Thanks

avatar chrisdavenport chrisdavenport - change - 8 May 2016
Status New Confirmed
avatar chrisdavenport
chrisdavenport - comment - 8 May 2016

Confirmed. Can you provide a pull request?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9742.

avatar nsrsr
nsrsr - comment - 10 May 2016

done, thank you, see #10369


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9742.

avatar brianteeman brianteeman - change - 5 Aug 2016
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-08-05 13:33:45
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 5 Aug 2016

Closed as we had a PR and that has been merged.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9742.

Add a Comment

Login with GitHub to post a comment