ZF-1838: findManyToManyRowset fails because the table _schema attribute isn't used


in Zend_Db_Table_Row_Abstract the method findManyToManyRowset doesnt use the _schema attribute for the tables involved in the operation, fixed it by changing the following code

$interInfo = $intersectionTable->info();
$interName =  $interInfo['name'];
$matchInfo = $matchTable->info();
$matchName = $matchInfo['name'];

to this

$interInfo = $intersectionTable->info();
$interName = ( isset($interInfo['schema']) ? $interInfo['schema'] . '.' : '') . $interInfo['name'];
$matchInfo = $matchTable->info();
$matchName = ( isset($matchInfo['schema']) ? $matchInfo['schema'] . '.' : '') . $matchInfo['name'];


Assigning to [~bkarwin] to initiate issue review.

I have also come across this issue, and the attached fix works for me.


Possible functional solution

        //line 946:
        $interInfo   = $intersectionTable->info();
        $interName   = $interInfo['name'];
        $interSchema = isset($interInfo['schema']) ? $interInfo['schema'] : null;  //Add line
        $matchInfo   = $matchTable->info();
        $matchName   = $matchInfo['name'];
        $matchSchema = isset($matchInfo['schema']) ? $matchInfo['schema'] : null;  //Add line
       //line 960
        $select->from(array('i' => $interName), '*', $interSchema)  //To modify line
               ->joinInner(array('m' => $matchName), $joinCond, '*', $matchSchema)  //To modify line

I need this patch. I patched it in my sources manually but it would be great if this will be soon committed to svn.

This issue should have been fixed for the 1.5 release.

Please categorize/fix as needed.

This issue is now 8 months old. Why this isn´t fixed until yet? I patched my local copy of zend framework in less than a minute.

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

10 months and still waiting.

13 months and still waiting.


Do you think you could write test case that proves the fix?



The Zend_Db Testsuite is a hazzle to work with, I have to say.

Why is there no Mock Db Adapter that is used completly for a complete test run of Zend_Db_Table?

I do make the following assumptions for my workaround, implemented as a scenario test-case.

  1. The bug completely depends on Zend_Db_Select
  2. Zend_Db_Select testcases therefore cover the changes in their unittest suites.
  3. I build a scenario testcase for pdo_mysql and printed the before, after select statements of the ManyToMany.

This logic argument should cover the testcase 100%, thanks :-) I'll commit the patch.

Scenario test that works with the Database schema out of the ZF Db manual.

Thanks for your work :)

merged back into 1.7 release branch because of possible 1.7.3 release