ZF-5907: _setupPrimaryKey: array_intersect incorrect

Description

Since version 1.7.0 I get the error on row 772 of Zend/Db/Table/Abstract.php. When debugging I see that the array_intersect parameters can never get a positive result:

$cols is an array with the following content:


Array
(
    [account_id] => Array
        (
            [SCHEMA_NAME] => 
            [TABLE_NAME] => account
            [COLUMN_NAME] => account_id
            [COLUMN_POSITION] => 1
            [DATA_TYPE] => bigint
            [DEFAULT] => 
            [NULLABLE] => 
            [LENGTH] => 
            [SCALE] => 
            [PRECISION] => 
            [UNSIGNED] => 1
            [PRIMARY] => 1
            [PRIMARY_POSITION] => 1
            [IDENTITY] => 1
        )

    [accounttype_id] => Array
        (
            [SCHEMA_NAME] => 
            [TABLE_NAME] => account
            [COLUMN_NAME] => accounttype_id
            [COLUMN_POSITION] => 2
            [DATA_TYPE] => bigint
            [DEFAULT] => 1
            [NULLABLE] => 
            [LENGTH] => 
            [SCALE] => 
            [PRECISION] => 
            [UNSIGNED] => 
            [PRIMARY] => 
            [PRIMARY_POSITION] => 
            [IDENTITY] => 
        )
       ....

$this->_primary contains an array with the following content:


Array
(
    [1] => account_id
)

Can somebody please confirm this is a bug?

Comments

I've created a workaround for this issue:

{{monospaced}} } else if (isset($this->_primary[0])) { array_unshift($this->_primary, null); unset($this->_primary[0]); }

    $cols = $this->_getCols();

    foreach( (array) $this->_primary as $column ) {
        if( ! array_key_exists( $column, $cols ) ) {
            require_once 'Zend/Db/Table/Exception.php';
            throw new Zend_Db_Table_Exception("Primary key column(s) ("
                . implode(',', (array) $this->_primary)
                . ") are not columns in this table ("
                . implode(',', $cols)
                . ")");
        }
    }

    $primary    = (array) $this->_primary;
    $pkIdentity = $primary[(int) $this->_identity];

After more debugging I found out that this was not in issue in the Framework, but in my own code. Unfortunatly, I can not find an option to close this issue myself.