ZF-3344: Leftover variable assignment in Zend_Db_Table_Row_Abstract causes E_NOTICE error

Issue Type: Bug Created: 2008-05-28T14:05:30.000+0000 Last Updated: 2008-07-25T13:59:25.000+0000 Status: Resolved Fix version(s): - 1.5.3 (28/Jul/08)

Reporter: Adam Jensen (jazzslider) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Table

Related issues: Attachments:


On line 976 of Zend_Db_Table_Row_Abstract (revision 9565), the variable $matchColumnName is assigned. However, it is never used anywhere else in the class, which leads me to believe it's a leftover of some earlier version of this procedure.

Ordinarily this would not be a problem; however, occasionally it produces an E_NOTICE-level error which, given careless error-reporting settings, could expose potentially sensitive information to the end user about the location of the ZF installation on the server.

This situation arises when two tables are related by a third intersection table; the caller table is related to the intersection table via two of its columns, while the match table is related to the intersection table via only one of its columns. E.g.,

<pre class="highlight">
class CallerTable extends Zend_Db_Table_Abstract
    protected $_primary = array('pk1', 'pk2');
    protected $_sequence = false;

class MatchTable extends Zend_Db_Table_Abstract
    protected $_primary = 'pk';

class InterTable extends Zend_Db_Table_Abstract
    protected $_primary = array('match_pk', 'caller_pk1', 'caller_pk2');
    protected $_sequence = false;
    protected $_referenceMap = array(
        'Match' => array(
            'columns'         => 'match_pk',
            'refTableClass'   => 'MatchTable',
            'refTableColumns' => 'pk'
        'Caller' => array(
            'columns'         => array('caller_pk1', 'caller_pk2'),
            'refTableClass'   => 'CallerTable',
            'refTableColumns' => array('pk1', 'pk2')

$callerTable = new CallerTable();
$callerRow = $callerTable->find('first-part-of-key', 'second-part')->current();
$matches = $callerRow->findManyToManyRowset('MatchTable', 'InterTable');

Although the $matches variable is correctly populated, the following E_NOTICE error is emitted: "Notice: Undefined offset: 1 in /path/to/Zend/Db/Table/Row/Abstract.php on line 976"

This issue could be easily resolved by removing line 976 of Zend_Db_Table_Row_Abstract. Since the variable assigned on that line is never used, the only result of this will be that the E_NOTICE error is no longer emitted.



Posted by Wil Sinclair (wil) on 2008-06-05T18:09:42.000+0000

Please evaluate and categorize/fix as necessary.

Posted by Ralph Schindler (ralph) on 2008-07-25T09:27:22.000+0000

Fixed in r10407

Posted by Ralph Schindler (ralph) on 2008-07-25T13:59:25.000+0000

Fixed for 1.5.3 at revision 10433

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.